mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX DatetimeFieldTest
This commit is contained in:
parent
310a259c5f
commit
c414388220
@ -109,11 +109,11 @@ class DatetimeFieldTest extends SapphireTest
|
|||||||
{
|
{
|
||||||
$f = new DatetimeField('Datetime', 'Datetime');
|
$f = new DatetimeField('Datetime', 'Datetime');
|
||||||
$f->setValue('2003-03-29 23:59:38');
|
$f->setValue('2003-03-29 23:59:38');
|
||||||
$this->assertEquals($f->dataValue(), '2003-03-29 23:59:38', 'Accepts ISO');
|
$this->assertEquals('2003-03-29 23:59:38', $f->dataValue(), 'Accepts ISO');
|
||||||
|
|
||||||
$f = new DatetimeField('Datetime', 'Datetime');
|
$f = new DatetimeField('Datetime', 'Datetime');
|
||||||
$f->setValue('2003-03-29T23:59:38');
|
$f->setValue('2003-03-29T23:59:38');
|
||||||
$this->assertNull($f->dataValue(), 'Rejects normalised ISO');
|
$this->assertEquals('2003-03-29 23:59:38', $f->dataValue(), 'Accepts normalised ISO');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmittedValue()
|
public function testSubmittedValue()
|
||||||
@ -152,7 +152,7 @@ class DatetimeFieldTest extends SapphireTest
|
|||||||
$this->assertTrue($f->validate(new RequiredFields()));
|
$this->assertTrue($f->validate(new RequiredFields()));
|
||||||
|
|
||||||
$f = new DatetimeField('Datetime', 'Datetime', '2003-03-29T23:59:38');
|
$f = new DatetimeField('Datetime', 'Datetime', '2003-03-29T23:59:38');
|
||||||
$this->assertFalse($f->validate(new RequiredFields()), 'Normalised ISO');
|
$this->assertTrue($f->validate(new RequiredFields()), 'Normalised ISO');
|
||||||
|
|
||||||
$f = new DatetimeField('Datetime', 'Datetime', '2003-03-29');
|
$f = new DatetimeField('Datetime', 'Datetime', '2003-03-29');
|
||||||
$this->assertFalse($f->validate(new RequiredFields()), 'Leaving out time');
|
$this->assertFalse($f->validate(new RequiredFields()), 'Leaving out time');
|
||||||
|
Loading…
Reference in New Issue
Block a user