Skip to content
Snippets Groups Projects
Commit 956dbeaf authored by Carsten  Rose's avatar Carsten Rose
Browse files

FillStoreFormTest.php: fixed some wrong static calls.

parent d89c083d
No related branches found
No related tags found
No related merge requests found
Pipeline #907 passed
......@@ -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");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment