mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
More min/max setter tests
This commit is contained in:
parent
b852a76334
commit
9b41350f64
@ -153,6 +153,30 @@ class DatetimeFieldTest extends SapphireTest
|
|||||||
$this->assertFalse($f->validate(new RequiredFields()));
|
$this->assertFalse($f->validate(new RequiredFields()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSetMinDate()
|
||||||
|
{
|
||||||
|
$f = (new DatetimeField('Datetime'))->setMinDatetime('2009-03-31T23:00:00');
|
||||||
|
$this->assertEquals($f->getMinDatetime(), '2009-03-31T23:00:00', 'Retains normalised ISO');
|
||||||
|
|
||||||
|
$f = (new DatetimeField('Datetime'))->setMinDatetime('2009-03-31 23:00:00');
|
||||||
|
$this->assertEquals($f->getMinDatetime(), '2009-03-31T23:00:00', 'Converts ISO to normalised ISO');
|
||||||
|
|
||||||
|
$f = (new DatetimeField('Datetime'))->setMinDatetime('invalid');
|
||||||
|
$this->assertNull($f->getMinDatetime(), 'Ignores invalid values');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetMaxDate()
|
||||||
|
{
|
||||||
|
$f = (new DatetimeField('Datetime'))->setMaxDatetime('2009-03-31T23:00:00');
|
||||||
|
$this->assertEquals($f->getMaxDatetime(), '2009-03-31T23:00:00', 'Retains normalised ISO');
|
||||||
|
|
||||||
|
$f = (new DatetimeField('Datetime'))->setMaxDatetime('2009-03-31 23:00:00');
|
||||||
|
$this->assertEquals($f->getMaxDatetime(), '2009-03-31T23:00:00', 'Converts ISO to normalised ISO');
|
||||||
|
|
||||||
|
$f = (new DatetimeField('Datetime'))->setMaxDatetime('invalid');
|
||||||
|
$this->assertNull($f->getMaxDatetime(), 'Ignores invalid values');
|
||||||
|
}
|
||||||
|
|
||||||
public function testValidateMinDate()
|
public function testValidateMinDate()
|
||||||
{
|
{
|
||||||
$dateField = new DatetimeField('Datetime');
|
$dateField = new DatetimeField('Datetime');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user