[
$EMPTY_REQUEST, $NO_USER_PREF,
'default', $defaultNS,
- 'Bug 33270: No request nor user preferences should give default profile'
+ 'T35270: No request nor user preferences should give default profile'
],
[
[ 'ns5' => 1 ], $NO_USER_PREF,
return "searchNs$ns";
}, $defaultNS ), 0 ),
'advanced', [ 2, 14 ],
- 'Bug 33583: search with no option should honor User search preferences'
+ 'T35583: search with no option should honor User search preferences'
. ' and have all other namespace disabled'
],
];
[
'With suggestion and no rewritten query shows did you mean',
'/Did you mean: <a[^>]+>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 <a[^>]+>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',
+ []
],
];
}
/**
* @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();