Consistent sorting for getDiffList()

If changes were applied in the same second (e.g. through tests), the results will have an indeterminate order.
This lead to stability issues in VersionFeedFunctionalTest::testContainsChangesForPageOnly.
Sort by ID in addition to LastEdited.
This commit is contained in:
Ingo Schommer 2016-05-20 09:27:37 +12:00
parent 73a033f22d
commit c64e7ad2d7
1 changed files with 3 additions and 1 deletions

View File

@ -61,7 +61,9 @@ class VersionFeed extends SiteTreeExtension {
// Get just enough elements for diffing. We need one more than desired to have something to compare to.
$qLimit = (int)$limit + 1;
$versions = $this->owner->allVersions(
"\"WasPublished\"='1' AND \"CanViewType\" IN ('Anyone', 'Inherit') $offset", "\"LastEdited\" DESC", $qLimit
"\"WasPublished\"='1' AND \"CanViewType\" IN ('Anyone', 'Inherit') $offset",
"\"SiteTree\".\"LastEdited\" DESC, \"SiteTree\".\"ID\" DESC",
$qLimit
);
// Process the list to add the comparisons.