mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Fixed AggregateTest for MSSQLDatabase (wrong date formatting) (from r103640)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112156 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8da5de8d41
commit
f5fb01d11b
@ -93,13 +93,13 @@ class AggregateTest extends SapphireTest {
|
|||||||
*/
|
*/
|
||||||
function testBaseFieldAggregate() {
|
function testBaseFieldAggregate() {
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
DataObject::Aggregate('AggregateTest_Foo')->Max('LastEdited'),
|
$this->formatDate(DataObject::Aggregate('AggregateTest_Foo')->Max('LastEdited')),
|
||||||
DataObject::get_one('AggregateTest_Foo', '', '', 'LastEdited DESC')->LastEdited
|
$this->formatDate(DataObject::get_one('AggregateTest_Foo', '', '', 'LastEdited DESC')->LastEdited)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
DataObject::Aggregate('AggregateTest_Foo')->Max('Created'),
|
$this->formatDate(DataObject::Aggregate('AggregateTest_Foo')->Max('Created')),
|
||||||
DataObject::get_one('AggregateTest_Foo', '', '', 'Created DESC')->Created
|
$this->formatDate(DataObject::get_one('AggregateTest_Foo', '', '', 'Created DESC')->Created)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/* */
|
/* */
|
||||||
@ -175,4 +175,14 @@ class AggregateTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copied from DataObject::__construct(), special case for MSSQLDatabase.
|
||||||
|
*
|
||||||
|
* @param String
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
protected function formatDate($dateStr) {
|
||||||
|
$dateStr = preg_replace('/:[0-9][0-9][0-9]([ap]m)$/i', ' \\1', $dateStr);
|
||||||
|
return date('Y-m-d H:i:s', strtotime($dateStr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user