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:
Fred Condo 2012-03-09 15:34:16 -08:00
parent 6e6890f689
commit df050eda5d

View File

@ -35,6 +35,8 @@ class SS_DatetimeTest extends SapphireTest {
}
function testSetNullAndZeroValues() {
date_default_timezone_set('UTC');
$date = DBField::create('SS_Datetime', '');
$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');
$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);
$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');
}
}