X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fspecials%2FSpecialSearchTest.php;h=4e9d8263609dca44b462aecf17ca0539ef8738af;hb=6fbafe5494440f5c37686b250ed759f6a96271b9;hp=9daae9741eeb4934f9f44eadadef36714d9e039c;hpb=6cdcc7416c64a635df9aa15170d2df13ecbbd82d;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/phpunit/includes/specials/SpecialSearchTest.php b/tests/phpunit/includes/specials/SpecialSearchTest.php
index 9daae9741e..4e9d826360 100644
--- a/tests/phpunit/includes/specials/SpecialSearchTest.php
+++ b/tests/phpunit/includes/specials/SpecialSearchTest.php
@@ -150,23 +150,25 @@ class SpecialSearchTest extends MediaWikiTestCase {
[
'With suggestion and no rewritten query shows did you mean',
'/Did you mean: ]+>first suggestion/',
- new SpecialSearchTestMockResultSet( 'first suggestion', null, [
- SearchResult::newFromTitle( Title::newMainPage() ),
- ] ),
+ 'first suggestion',
+ null,
+ [ Title::newMainPage() ]
],
[
'With rewritten query informs user of change',
'/Showing results for ]+>first suggestion/',
- new SpecialSearchTestMockResultSet( 'asdf', 'first suggestion', [
- SearchResult::newFromTitle( Title::newMainPage() ),
- ] ),
+ 'asdf',
+ 'first suggestion',
+ [ Title::newMainPage() ]
],
[
'When both queries have no results user gets no results',
'/There were no results matching the query/',
- new SpecialSearchTestMockResultSet( 'first suggestion', 'first suggestion', [] ),
+ 'first suggestion',
+ 'first suggestion',
+ []
],
];
}
@@ -174,8 +176,24 @@ class SpecialSearchTest extends MediaWikiTestCase {
/**
* @dataProvider provideRewriteQueryWithSuggestion
*/
- public function testRewriteQueryWithSuggestion( $message, $expectRegex, $results ) {
- $mockSearchEngine = $this->mockSearchEngine( $results );
+ public function testRewriteQueryWithSuggestion(
+ $message,
+ $expectRegex,
+ $suggestion,
+ $rewrittenQuery,
+ array $resultTitles
+ ) {
+ $results = array_map( function( $title ) {
+ return SearchResult::newFromTitle( $title );
+ }, $resultTitles );
+
+ $searchResults = new SpecialSearchTestMockResultSet(
+ $suggestion,
+ $rewrittenQuery,
+ $results
+ );
+
+ $mockSearchEngine = $this->mockSearchEngine( $searchResults );
$search = $this->getMockBuilder( 'SpecialSearch' )
->setMethods( [ 'getSearchEngine' ] )
->getMock();