Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit df050eda5d7c6ad6234d8ae7d94b46a4ddff8449 1 parent 6e6890f
@oddnoc oddnoc authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 tests/model/DatetimeTest.php
View
6 tests/model/DatetimeTest.php
@@ -35,6 +35,8 @@ function testNowWithMockDate() {
}
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 @@ function testSetNullAndZeroValues() {
$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');
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.