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
956dbeaf
Commit
956dbeaf
authored
Sep 15, 2018
by
Carsten Rose
Browse files
FillStoreFormTest.php: fixed some wrong static calls.
parent
d89c083d
Pipeline
#907
passed with stage
in 1 minute and 47 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/qfq/tests/phpunit/FillStoreFormTest.php
View file @
956dbeaf
...
...
@@ -23,45 +23,61 @@ use PHPUnit\Framework\TestCase;
class
FillStoreFormTest
extends
TestCase
{
/**
* @throws CodeException
* @throws DbException
* @throws UserFormException
* @throws UserReportException
*/
public
function
testDoDateTime
()
{
$formElement
=
[
FE_TYPE
=>
FE_TYPE_DATE
,
FE_DATE_FORMAT
=>
FORMAT_DATE_INTERNATIONAL
,
FE_SHOW_SECONDS
=>
0
];
$fsf
=
new
FillStoreForm
();
$msg
=
'doDateTime fails'
;
$val
=
'2010-03-31'
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
$val
),
$msg
);
$this
->
assertEquals
(
$val
,
$fsf
->
doDateTime
(
$formElement
,
$val
),
$msg
);
$val
=
'2010-02-28'
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
$val
),
$msg
);
$this
->
assertEquals
(
$val
,
$fsf
->
doDateTime
(
$formElement
,
$val
),
$msg
);
$val
=
'2012-02-29'
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
$val
),
$msg
);
$this
->
assertEquals
(
$val
,
$fsf
->
doDateTime
(
$formElement
,
$val
),
$msg
);
$formElement
[
FE_DATE_FORMAT
]
=
FORMAT_DATE_GERMAN
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
'29.02.2012'
),
$msg
);
$this
->
assertEquals
(
$val
,
$fsf
->
doDateTime
(
$formElement
,
'29.02.2012'
),
$msg
);
}
/**
* @expectedException \qfq\UserFormException
* @throws CodeException
* @throws DbException
* @throws UserFormException
* @throws UserReportException
*/
public
function
testDoDateTimeInvalidDate
()
{
$formElement
=
[
FE_TYPE
=>
FE_TYPE_DATE
,
FE_DATE_FORMAT
=>
FORMAT_DATE_INTERNATIONAL
,
FE_SHOW_SECONDS
=>
0
];
$fsf
=
new
FillStoreForm
();
$val
=
'2010-02-29'
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
$val
),
"doDateTime is passing when it shouldn't"
);
$this
->
assertEquals
(
$val
,
$fsf
->
doDateTime
(
$formElement
,
$val
),
"doDateTime is passing when it shouldn't"
);
}
/**
* @expectedException \qfq\UserFormException
* @throws CodeException
* @throws DbException
* @throws UserFormException
* @throws UserReportException
*/
public
function
testDoDateTimeInvalidDateWithTime
()
{
$formElement
=
[
FE_TYPE
=>
FE_TYPE_DATE
,
FE_DATE_FORMAT
=>
FORMAT_DATE_INTERNATIONAL
,
FE_SHOW_SECONDS
=>
0
];
$fsf
=
new
FillStoreForm
();
$val
=
'2010-02-31 23:25'
;
$this
->
assertEquals
(
$val
,
FillStoreForm
::
doDateTime
(
$formElement
,
$val
),
"doDateTime is passing when it shouldn't"
);
$this
->
assertEquals
(
$val
,
$fsf
->
doDateTime
(
$formElement
,
$val
),
"doDateTime is passing when it shouldn't"
);
}
...
...
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