mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: Correct testSetNullAndZeroValues() of DatetimeTest
- Code was assuming NZ time zone - Set the default timezone to UTC for the test - Correct the expected times for the epoch from noon to 00:00:00 UTC
This commit is contained in:
parent
6e6890f689
commit
df050eda5d
@ -35,6 +35,8 @@ class SS_DatetimeTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSetNullAndZeroValues() {
|
function testSetNullAndZeroValues() {
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
$date = DBField::create('SS_Datetime', '');
|
$date = DBField::create('SS_Datetime', '');
|
||||||
$this->assertNull($date->getValue(), 'Empty string evaluates to NULL');
|
$this->assertNull($date->getValue(), 'Empty string evaluates to NULL');
|
||||||
|
|
||||||
@ -45,10 +47,10 @@ class SS_DatetimeTest extends SapphireTest {
|
|||||||
$this->assertNull($date->getValue(), 'Boolean FALSE evaluates to NULL');
|
$this->assertNull($date->getValue(), 'Boolean FALSE evaluates to NULL');
|
||||||
|
|
||||||
$date = DBField::create('SS_Datetime', '0');
|
$date = DBField::create('SS_Datetime', '0');
|
||||||
$this->assertEquals('1970-01-01 12:00:00', $date->getValue(), 'String zero is UNIX epoch time');
|
$this->assertEquals('1970-01-01 00:00:00', $date->getValue(), 'String zero is UNIX epoch time');
|
||||||
|
|
||||||
$date = DBField::create('SS_Datetime', 0);
|
$date = DBField::create('SS_Datetime', 0);
|
||||||
$this->assertEquals('1970-01-01 12:00:00', $date->getValue(), 'Numeric zero is UNIX epoch time');
|
$this->assertEquals('1970-01-01 00:00:00', $date->getValue(), 'Numeric zero is UNIX epoch time');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user