mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
Don't rely on MySQL ordering of index->getAdded()
MySQL is more reliable in its output ordering of elements where the order doesn't matter. PostgreSQL is not. This meant that this test "accidentally passed" on MySQL and failed on PostgreSQL. The sort function resolves this.
This commit is contained in:
parent
995a8a1d01
commit
4b51393e01
@ -107,7 +107,13 @@ class SearchUpdaterTest extends SapphireTest {
|
|||||||
|
|
||||||
// Check the default "writing a document updates the document"
|
// Check the default "writing a document updates the document"
|
||||||
SearchUpdater::flush_dirty_indexes();
|
SearchUpdater::flush_dirty_indexes();
|
||||||
$this->assertEquals(self::$index->getAdded(array('ID')), array(
|
|
||||||
|
|
||||||
|
$added = self::$index->getAdded(array('ID'));
|
||||||
|
// Some databases don't output $added in a consistent order; that's okay
|
||||||
|
usort($added, function($a,$b) {return $a['ID']-$b['ID']; });
|
||||||
|
|
||||||
|
$this->assertEquals($added, array(
|
||||||
array('ID' => $container1->ID),
|
array('ID' => $container1->ID),
|
||||||
array('ID' => $container2->ID),
|
array('ID' => $container2->ID),
|
||||||
array('ID' => $container3->ID)
|
array('ID' => $container3->ID)
|
||||||
@ -121,7 +127,11 @@ class SearchUpdaterTest extends SapphireTest {
|
|||||||
$hasOne->write();
|
$hasOne->write();
|
||||||
|
|
||||||
SearchUpdater::flush_dirty_indexes();
|
SearchUpdater::flush_dirty_indexes();
|
||||||
$this->assertEquals(self::$index->getAdded(array('ID')), array(
|
$added = self::$index->getAdded(array('ID'));
|
||||||
|
// Some databases don't output $added in a consistent order; that's okay
|
||||||
|
usort($added, function($a,$b) {return $a['ID']-$b['ID']; });
|
||||||
|
|
||||||
|
$this->assertEquals($added, array(
|
||||||
array('ID' => $container1->ID),
|
array('ID' => $container1->ID),
|
||||||
array('ID' => $container2->ID)
|
array('ID' => $container2->ID)
|
||||||
));
|
));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user