From: Aaron Schulz Date: Fri, 19 May 2017 00:40:06 +0000 (-0700) Subject: Avoid postgres PrefixSearchTest failures due to collation differences X-Git-Tag: 1.31.0-rc.0~3223^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=99772f2d8a1c3a1de6b23825a76814f8def7a5bd;p=lhc%2Fweb%2Fwiklou.git Avoid postgres PrefixSearchTest failures due to collation differences Bug: T75174 Change-Id: I6b1df27ca6ae5c2da46134be3dbd7aed404d9601 --- diff --git a/tests/phpunit/includes/PrefixSearchTest.php b/tests/phpunit/includes/PrefixSearchTest.php index 31ee75b788..a6cf14a3ad 100644 --- a/tests/phpunit/includes/PrefixSearchTest.php +++ b/tests/phpunit/includes/PrefixSearchTest.php @@ -210,6 +210,11 @@ class PrefixSearchTest extends MediaWikiLangTestCase { $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 @@ class PrefixSearchTest extends MediaWikiLangTestCase { $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