mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR FIX: columns quoted properly + database agnostic version of RANDOM() created
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@86505 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e1763ab4f2
commit
5e15362a32
@ -317,10 +317,10 @@ class DataObjectTest extends SapphireTest {
|
|||||||
$this->assertEquals($keysA, $keysB);
|
$this->assertEquals($keysA, $keysB);
|
||||||
|
|
||||||
/* If we perform the same random query twice, it shouldn't return the same results */
|
/* If we perform the same random query twice, it shouldn't return the same results */
|
||||||
$itemsA = DataObject::get("PageComment", "", "RAND()");
|
$itemsA = DataObject::get("PageComment", "", DB::getConn()->random());
|
||||||
foreach($itemsA as $item) $keysA[] = $item->ID;
|
foreach($itemsA as $item) $keysA[] = $item->ID;
|
||||||
|
|
||||||
$itemsB = DataObject::get("PageComment", "", "RAND()");
|
$itemsB = DataObject::get("PageComment", "", DB::getConn()->random());
|
||||||
foreach($itemsB as $item) $keysB[] = $item->ID;
|
foreach($itemsB as $item) $keysB[] = $item->ID;
|
||||||
|
|
||||||
$this->assertNotEquals($keysA, $keysB);
|
$this->assertNotEquals($keysA, $keysB);
|
||||||
@ -752,7 +752,7 @@ class DataObjectTest extends SapphireTest {
|
|||||||
$obj2->write();
|
$obj2->write();
|
||||||
|
|
||||||
// Check that the values of those fields are properly read from the database
|
// Check that the values of those fields are properly read from the database
|
||||||
$values = DataObject::get("DataObjectTest_Team", "DataObjectTest_Team.ID IN
|
$values = DataObject::get("DataObjectTest_Team", "\"DataObjectTest_Team\".\"ID\" IN
|
||||||
($obj1->ID, $obj2->ID)")->column("SubclassDatabaseField");
|
($obj1->ID, $obj2->ID)")->column("SubclassDatabaseField");
|
||||||
$this->assertEquals(array('obj1', 'obj2'), $values);
|
$this->assertEquals(array('obj1', 'obj2'), $values);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user