* after an assertion fail.
*/
$this->assertEquals(
- array( /** Expected: */
+ [ /** Expected: */
'ProfileName' => $expectedProfile,
'Namespaces' => $expectedNS,
- ),
- array( /** Actual: */
+ ],
+ [ /** Actual: */
'ProfileName' => $search->getProfile(),
'Namespaces' => $search->getNamespaces(),
- ),
+ ],
$message
);
}
public static function provideSearchOptionsTests() {
$defaultNS = SearchEngine::defaultNamespaces();
- $EMPTY_REQUEST = array();
+ $EMPTY_REQUEST = [];
$NO_USER_PREF = null;
- return array(
+ return [
/**
* Parameters:
* <Web Request>, <User options>
* <ProfileName>, <NSList>
* Then an optional message.
*/
- array(
+ [
$EMPTY_REQUEST, $NO_USER_PREF,
'default', $defaultNS,
'Bug 33270: No request nor user preferences should give default profile'
- ),
- array(
- array( 'ns5' => 1 ), $NO_USER_PREF,
- 'advanced', array( 5 ),
+ ],
+ [
+ [ 'ns5' => 1 ], $NO_USER_PREF,
+ 'advanced', [ 5 ],
'Web request with specific NS should override user preference'
- ),
- array(
- $EMPTY_REQUEST, array(
+ ],
+ [
+ $EMPTY_REQUEST, [
'searchNs2' => 1,
'searchNs14' => 1,
- ) + array_fill_keys( array_map( function ( $ns ) {
+ ] + array_fill_keys( array_map( function ( $ns ) {
return "searchNs$ns";
}, $defaultNS ), 0 ),
- 'advanced', array( 2, 14 ),
+ 'advanced', [ 2, 14 ],
'Bug 33583: search with no option should honor User search preferences'
. ' and have all other namespace disabled'
- ),
- );
+ ],
+ ];
}
/**
* https://gerrit.wikimedia.org/r/4841
*/
public function testSearchTermIsNotExpanded() {
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgSearchType' => null,
- ) );
+ ] );
# Initialize [[Special::Search]]
$search = new SpecialSearch();
}
public function provideRewriteQueryWithSuggestion() {
- return array(
- array(
+ return [
+ [
'With suggestion and no rewritten query shows did you mean',
'/Did you mean: <a[^>]+>first suggestion/',
- new SpecialSearchTestMockResultSet( 'first suggestion', null, array(
+ new SpecialSearchTestMockResultSet( 'first suggestion', null, [
SearchResult::newFromTitle( Title::newMainPage() ),
- ) ),
- ),
+ ] ),
+ ],
- array(
+ [
'With rewritten query informs user of change',
'/Showing results for <a[^>]+>first suggestion/',
- new SpecialSearchTestMockResultSet( 'asdf', 'first suggestion', array(
+ new SpecialSearchTestMockResultSet( 'asdf', 'first suggestion', [
SearchResult::newFromTitle( Title::newMainPage() ),
- ) ),
- ),
+ ] ),
+ ],
- array(
+ [
'When both queries have no results user gets no results',
'/There were no results matching the query/',
- new SpecialSearchTestMockResultSet( 'first suggestion', 'first suggestion', array() ),
- ),
- );
+ new SpecialSearchTestMockResultSet( 'first suggestion', 'first suggestion', [] ),
+ ],
+ ];
}
/**
public function testRewriteQueryWithSuggestion( $message, $expectRegex, $results ) {
$mockSearchEngine = $this->mockSearchEngine( $results );
$search = $this->getMockBuilder( 'SpecialSearch' )
- ->setMethods( array( 'getSearchEngine' ) )
+ ->setMethods( [ 'getSearchEngine' ] )
->getMock();
$search->expects( $this->any() )
->method( 'getSearchEngine' )
protected function mockSearchEngine( $results ) {
$mock = $this->getMockBuilder( 'SearchEngine' )
- ->setMethods( array( 'searchText', 'searchTitle' ) )
+ ->setMethods( [ 'searchText', 'searchTitle' ] )
->getMock();
$mock->expects( $this->any() )
public function __construct(
$suggestion = null,
$rewrittenQuery = null,
- array $results = array(),
+ array $results = [],
$containedSyntax = false
) {
$this->suggestion = $suggestion;