Aaron Schulz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354376 )

Change subject: Avoid postgres PrefixSearchTest failures due to collation 
differences
......................................................................

Avoid postgres PrefixSearchTest failures due to collation differences

Bug: T75174
Change-Id: I6b1df27ca6ae5c2da46134be3dbd7aed404d9601
---
M tests/phpunit/includes/PrefixSearchTest.php
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/76/354376/1

diff --git a/tests/phpunit/includes/PrefixSearchTest.php 
b/tests/phpunit/includes/PrefixSearchTest.php
index 31ee75b..a6cf14a 100644
--- a/tests/phpunit/includes/PrefixSearchTest.php
+++ b/tests/phpunit/includes/PrefixSearchTest.php
@@ -210,6 +210,11 @@
 
                $namespaces = isset( $case['namespaces'] ) ? 
$case['namespaces'] : [];
 
+               if ( wfGetDB( DB_REPLICA )->getType() === 'postgres' ) {
+                       // Postgres will sort lexicographically on utf8 code 
units (" " before "/")
+                       sort( $case['results'], SORT_STRING );
+               }
+
                $searcher = new StringPrefixSearch;
                $results = $searcher->search( $case['query'], 3, $namespaces );
                $this->assertEquals(
@@ -232,6 +237,11 @@
                $searcher = new StringPrefixSearch;
                $results = $searcher->search( $case['query'], 3, $namespaces, 1 
);
 
+               if ( wfGetDB( DB_REPLICA )->getType() === 'postgres' ) {
+                       // Postgres will sort lexicographically on utf8 code 
units (" " before "/")
+                       sort( $case['results'], SORT_STRING );
+               }
+
                // We don't expect the first result when offsetting
                array_shift( $case['results'] );
                // And sometimes we expect a different last result

-- 
To view, visit https://gerrit.wikimedia.org/r/354376
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b1df27ca6ae5c2da46134be3dbd7aed404d9601
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to