X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FPrefixSearchTest.php;h=2f3e569613d7ed2a42eedff26aaf2d9bc6fd7411;hb=3ad5a6d28a8ee5e1141861292c2528900ae0464a;hp=cf2e1205bede16a26bf2c6c1ce4584fa9bd67aa9;hpb=82524dc4da650c8017767a2648ed92dde98b8cae;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/PrefixSearchTest.php b/tests/phpunit/includes/PrefixSearchTest.php index cf2e1205be..2f3e569613 100644 --- a/tests/phpunit/includes/PrefixSearchTest.php +++ b/tests/phpunit/includes/PrefixSearchTest.php @@ -1,4 +1,7 @@ handlers = []; // Clear caches so that our new namespace appears - MWNamespace::getCanonicalNamespaces( true ); + MWNamespace::clearCaches(); Language::factory( 'en' )->resetNamespaces(); SpecialPageFactory::resetList(); } public function tearDown() { + MWNamespace::clearCaches(); + Language::factory( 'en' )->resetNamespaces(); + parent::tearDown(); TestingAccessWrapper::newFromClass( 'Hooks' )->handlers = $this->originalHandlers; @@ -207,6 +213,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( @@ -229,6 +240,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