Use more robust Format() in test instead of strtotime()

This commit is contained in:
Sean Harvey 2012-09-07 16:23:59 +12:00
parent 08eea5cde3
commit 4de7829e4c

View File

@ -9,12 +9,12 @@ class MSSQLDatabaseQueryTest extends SapphireTest {
public function testDateValueFormatting() {
$obj = $this->objFromFixture('MSSQLDatabaseQueryTestDataObject', 'test-data-1');
$this->assertEquals('2012-01-01', date('Y-m-d', strtotime($obj->TestDate)), 'Date field value is formatted correctly (Y-m-d)');
$this->assertEquals('2012-01-01', $obj->obj('TestDate')->Format('Y-m-d'), 'Date field value is formatted correctly (Y-m-d)');
}
public function testDatetimeValueFormatting() {
$obj = $this->objFromFixture('MSSQLDatabaseQueryTestDataObject', 'test-data-1');
$this->assertEquals('2012-01-01 10:30:00', $obj->TestDatetime, 'Datetime field value is formatted correctly (Y-m-d H:i:s)');
$this->assertEquals('2012-01-01 10:30:00', $obj->obj('TestDatetime')->Format('Y-m-d H:i:s'), 'Datetime field value is formatted correctly (Y-m-d H:i:s)');
}
}