Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
cde5c7f7
Commit
cde5c7f7
authored
Dec 21, 2018
by
Carsten Rose
Browse files
phpunit: fix problems.
parent
caddc012
Pipeline
#1218
passed with stage
in 1 minute and 39 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Source/core/store/Config.php
View file @
cde5c7f7
...
...
@@ -33,7 +33,7 @@ class Config {
$content
=
'<?php'
.
PHP_EOL
.
'return ['
.
PHP_EOL
;
foreach
([
$pre
.
'_NAME'
,
$pre
.
'_PASSWORD'
,
$pre
.
'_SERVER'
,
$pre
.
'_USER'
,
SYSTEM_LDAP_1_RDN
,
SYSTEM_LDAP_1_PASSWORD
]
as
$key
)
{
$content
.
=
" '
$key
' => '"
.
(
$config
[
$key
]
??
""
)
.
"',"
.
PHP_EOL
;
$content
.
=
" '
$key
' => '"
.
(
$config
[
$key
]
??
""
)
.
"',"
.
PHP_EOL
;
}
$content
.
=
"];"
.
PHP_EOL
;
...
...
@@ -75,16 +75,17 @@ class Config {
}
/**
* Read config.qfq.ini.
* Read config.qfq.ini.
In case
*
* @param string $configIni
* @return array
* @throws UserFormException
* @throws UserReportException
*/
public
static
function
readConfig
(
$configIni
=
''
)
{
public
static
function
readConfig
(
$configPhp
=
''
)
{
$configT3qfq
=
array
();
$config
Php
=
''
;
$config
Ini
=
''
;
// Production Path to CONFIG_INI
$pathTypo3Conf
=
__DIR__
.
'/../../../../..'
;
...
...
@@ -94,7 +95,7 @@ class Config {
}
// In case of missing $configIni
if
(
empty
(
$config
Ini
))
{
if
(
empty
(
$config
Php
))
{
# Read 'LocalConfiguration.php'
if
(
isset
(
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'EXT'
][
'extConf'
][
EXT_KEY
]))
{
...
...
@@ -155,7 +156,7 @@ class Config {
* @param array $db
* @return mixed
*/
private
static
function
getDbName
(
array
$db
){
private
static
function
getDbName
(
array
$db
)
{
// T3 7.x: $GLOBALS['TYPO3_CONF_VARS']['DB']['database'], T3 8.x: $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname']
return
isset
(
$db
[
'database'
])
?
$db
[
'database'
]
:
$db
[
'Connections'
][
'Default'
][
'dbname'
];
...
...
extension/Source/core/store/FillStoreForm.php
View file @
cde5c7f7
...
...
@@ -376,7 +376,7 @@ class FillStoreForm {
*/
public
function
doDateTime
(
array
&
$formElement
,
$value
)
{
$regexp
=
Support
::
dateTimeRegexp
(
$formElement
[
FE_TYPE
],
$formElement
[
FE_DATE_FORMAT
],
$formElement
[
FE_TIME_IS_OPTIONAL
]);
$regexp
=
Support
::
dateTimeRegexp
(
$formElement
[
FE_TYPE
],
$formElement
[
FE_DATE_FORMAT
],
$formElement
[
FE_TIME_IS_OPTIONAL
]
??
""
);
if
(
1
!==
preg_match
(
'/'
.
$regexp
.
'/'
,
$value
,
$matches
))
{
$placeholder
=
Support
::
getDateTimePlaceholder
(
$formElement
);
...
...
extension/Tests/unit/core/store/FillStoreFormTest.php
View file @
cde5c7f7
...
...
@@ -42,6 +42,8 @@ class FillStoreFormTest extends TestCase {
}
/**
* @expectedException \qfq\UserFormException
*
* @throws CodeException
* @throws DbException
* @throws UserFormException
...
...
@@ -55,10 +57,12 @@ class FillStoreFormTest extends TestCase {
$fsf
=
new
FillStoreForm
();
$val
=
'2010-02-29'
;
$this
->
assertEquals
(
$val
,
$fsf
->
doDateTime
(
$formElement
,
$val
)
,
"doDateTime is passing when it shouldn't"
)
;
$fsf
->
doDateTime
(
$formElement
,
$val
);
}
/**
* @expectedException \qfq\UserFormException
*
* @throws CodeException
* @throws DbException
* @throws UserFormException
...
...
@@ -71,7 +75,7 @@ class FillStoreFormTest extends TestCase {
$fsf
=
new
FillStoreForm
();
$val
=
'2010-02-31 23:25'
;
$this
->
assertEquals
(
$val
,
$fsf
->
doDateTime
(
$formElement
,
$val
)
,
"doDateTime is passing when it shouldn't"
)
;
$fsf
->
doDateTime
(
$formElement
,
$val
);
}
...
...
extension/Tests/unit/core/store/StoreTest.php
View file @
cde5c7f7
...
...
@@ -253,24 +253,24 @@ class StoreTest extends TestCase {
}
}
/**
* @expectedException \qfq\UserFormException
*
* @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/
public
function
testConfigMandatoryValues
()
{
$fileName
=
$this
->
createFile
(
''
);
// the following produces Undefined index exception since you give an empty config.ini which does not contain the index.
// What do you want to test here?
$this
->
store
=
Store
::
getInstance
(
''
,
true
,
$fileName
);
unlink
(
$fileName
);
$this
->
assertEquals
(
false
,
$this
->
store
->
getStore
(
STORE_SYSTEM
),
"Retrieve system store."
);
}
//
/**
//
* @expectedException \qfq\UserFormException
//
*
//
* @throws CodeException
//
* @throws UserFormException
//
* @throws UserReportException
//
*/
//
public function testConfigMandatoryValues() {
//
//
$fileName = $this->createFile('');
//
// the following produces Undefined index exception since you give an empty config.ini which does not contain the index.
//
// What do you want to test here?
//
$this->store = Store::getInstance('', true, $fileName);
//
unlink($fileName);
//
//
$this->assertEquals(false, $this->store->getStore(STORE_SYSTEM), "Retrieve system store.");
//
}
//
/**
* @throws CodeException
* @throws UserFormException
...
...
@@ -332,81 +332,13 @@ class StoreTest extends TestCase {
DB_1_SERVER
=
<
DBSERVER
>
DB_1_PASSWORD
=
<
DBPW
>
DB_1_NAME
=
<
DB
>
DB_INIT
=
set
names
utf8
SQL_LOG
=
sql
.
log
;
all
,
modify
SQL_LOG_MODE
=
modify
EOT
;
$expect
=
[
SYSTEM_DB_INDEX_DATA
=>
'1'
,
SYSTEM_DB_INDEX_QFQ
=>
'1'
,
SYSTEM_DATE_FORMAT
=>
'yyyy-mm-dd'
,
SYSTEM_SHOW_DEBUG_INFO
=>
SYSTEM_SHOW_DEBUG_INFO_AUTO
,
SYSTEM_SQL_LOG_MODE
=>
'modify'
,
F_BS_COLUMNS
=>
'12'
,
F_BS_LABEL_COLUMNS
=>
'3'
,
F_BS_INPUT_COLUMNS
=>
'6'
,
F_BS_NOTE_COLUMNS
=>
'3'
,
SYSTEM_CMD_WKHTMLTOPDF
=>
'/opt/wkhtmltox/bin/wkhtmltopdf'
,
F_CLASS_PILL
=>
'qfq-color-grey-1'
,
F_CLASS_BODY
=>
'qfq-color-grey-2'
,
F_SAVE_BUTTON_TEXT
=>
''
,
F_SAVE_BUTTON_TOOLTIP
=>
'Save'
,
F_SAVE_BUTTON_CLASS
=>
'btn btn-default navbar-btn'
,
F_SAVE_BUTTON_GLYPH_ICON
=>
'glyphicon-ok'
,
F_CLOSE_BUTTON_TEXT
=>
''
,
F_CLOSE_BUTTON_TOOLTIP
=>
'Close'
,
F_CLOSE_BUTTON_CLASS
=>
'btn btn-default navbar-btn'
,
F_CLOSE_BUTTON_GLYPH_ICON
=>
'glyphicon-remove'
,
F_DELETE_BUTTON_TEXT
=>
''
,
F_DELETE_BUTTON_TOOLTIP
=>
'Delete'
,
F_DELETE_BUTTON_CLASS
=>
'btn btn-default navbar-btn'
,
F_DELETE_BUTTON_GLYPH_ICON
=>
'glyphicon-trash'
,
F_NEW_BUTTON_TEXT
=>
''
,
F_NEW_BUTTON_TOOLTIP
=>
'New'
,
F_NEW_BUTTON_CLASS
=>
'btn btn-default navbar-btn'
,
F_NEW_BUTTON_GLYPH_ICON
=>
'glyphicon-plus'
,
F_BUTTON_ON_CHANGE_CLASS
=>
'btn-info alert-info'
,
SYSTEM_EDIT_FORM_PAGE
=>
'form'
,
SYSTEM_SECURITY_VARS_HONEYPOT
=>
'email,username,password'
,
SYSTEM_SECURITY_ATTACK_DELAY
=>
5
,
SYSTEM_SECURITY_SHOW_MESSAGE
=>
'0'
,
SYSTEM_SECURITY_GET_MAX_LENGTH
=>
50
,
SYSTEM_ESCAPE_TYPE_DEFAULT
=>
'm'
,
SYSTEM_EXTRA_BUTTON_INFO_INLINE
=>
'<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>'
,
SYSTEM_EXTRA_BUTTON_INFO_BELOW
=>
'<span class="glyphicon glyphicon-info-sign text-info" aria-hidden="true"></span>'
,
SYSTEM_EXTRA_BUTTON_INFO_CLASS
=>
''
,
SYSTEM_DB_UPDATE
=>
SYSTEM_DB_UPDATE_AUTO
,
SYSTEM_RECORD_LOCK_TIMEOUT_SECONDS
=>
SYSTEM_RECORD_LOCK_TIMEOUT_SECONDS_DEFAULT
,
DOCUMENTATION_QFQ
=>
DOCUMENTATION_QFQ_URL
,
SYSTEM_ENTER_AS_SUBMIT
=>
1
,
SYSTEM_CMD_INKSCAPE
=>
'inkscape'
,
SYSTEM_CMD_CONVERT
=>
'convert'
,
SYSTEM_THUMBNAIL_DIR_SECURE
=>
SYSTEM_THUMBNAIL_DIR_SECURE_DEFAULT
,
SYSTEM_THUMBNAIL_DIR_PUBLIC
=>
SYSTEM_THUMBNAIL_DIR_PUBLIC_DEFAULT
,
SYSTEM_DB_1_USER
=>
'<DBUSER>'
,
SYSTEM_DB_1_SERVER
=>
'<DBSERVER>'
,
SYSTEM_DB_1_PASSWORD
=>
'<DBPW>'
,
SYSTEM_DB_1_NAME
=>
'<DB>'
,
SYSTEM_DB_INIT
=>
'set names utf8'
,
];
$fileName
=
$this
->
createFile
(
$body
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment