X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsearch%2FSearchEnginePrefixTest.php;h=4c5bab3fcc3df18b51a0d3693d386fbc3d6cefdd;hp=68338938c3e16b7d89406b05d76d6053e1d99cce;hb=c6d1ceb90a9684fa0da758d88ba1e994fad4cffc;hpb=980c688c2b9833fd83c3f4a7f5bf75031a071c74 diff --git a/tests/phpunit/includes/search/SearchEnginePrefixTest.php b/tests/phpunit/includes/search/SearchEnginePrefixTest.php index 68338938c3..4c5bab3fcc 100644 --- a/tests/phpunit/includes/search/SearchEnginePrefixTest.php +++ b/tests/phpunit/includes/search/SearchEnginePrefixTest.php @@ -1,5 +1,7 @@ insertPage( 'Example Foo' ); $this->insertPage( 'Example Foo/Bar' ); $this->insertPage( 'Example/Baz' ); + $this->insertPage( 'Sample' ); + $this->insertPage( 'Sample Ban' ); + $this->insertPage( 'Sample Eat' ); + $this->insertPage( 'Sample Who' ); + $this->insertPage( 'Sample Zoo' ); $this->insertPage( 'Redirect test', '#REDIRECT [[Redirect Test]]' ); $this->insertPage( 'Redirect Test' ); $this->insertPage( 'Redirect Test Worse Result' ); @@ -94,15 +101,15 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase { ] ], [ [ 'Main namespace with title prefix', - 'query' => 'Ex', + 'query' => 'Sa', 'results' => [ - 'Example', - 'Example/Baz', - 'Example Bar', + 'Sample', + 'Sample Ban', + 'Sample Eat', ], // Third result when testing offset 'offsetresult' => [ - 'Example Foo', + 'Sample Who', ], ] ], [ [ @@ -178,9 +185,10 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase { public function testSearch( array $case ) { $this->search->setLimitOffset( 3 ); $results = $this->search->defaultPrefixSearch( $case['query'] ); - $results = array_map( function( Title $t ) { + $results = array_map( function ( Title $t ) { return $t->getPrefixedText(); }, $results ); + $this->assertEquals( $case['results'], $results, @@ -195,7 +203,7 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase { public function testSearchWithOffset( array $case ) { $this->search->setLimitOffset( 3, 1 ); $results = $this->search->defaultPrefixSearch( $case['query'] ); - $results = array_map( function( Title $t ) { + $results = array_map( function ( Title $t ) { return $t->getPrefixedText(); }, $results ); @@ -341,7 +349,7 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase { $search->setLimitOffset( 3 ); $results = $search->completionSearch( $case['query'] ); - $results = $results->map( function( SearchSuggestion $s ) { + $results = $results->map( function ( SearchSuggestion $s ) { return $s->getText(); } );