X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsearch%2FSearchEngineTest.php;h=055e9823779d97ba9b86d404070e791cfc08ad0f;hb=a8995619c1bc0c0880962a266a0398bc87d1b7ae;hp=d0cbfa0a32a50a6c8dbb2405b12e671bf9f34640;hpb=e9c41b239cf67cc258f071586ed201d0bd9ee462;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/search/SearchEngineTest.php b/tests/phpunit/includes/search/SearchEngineTest.php index d0cbfa0a32..055e982377 100644 --- a/tests/phpunit/includes/search/SearchEngineTest.php +++ b/tests/phpunit/includes/search/SearchEngineTest.php @@ -31,9 +31,9 @@ class SearchEngineTest extends MediaWikiLangTestCase { } $searchType = $this->db->getSearchEngine(); - $this->setMwGlobals( array( + $this->setMwGlobals( [ 'wgSearchType' => $searchType - ) ); + ] ); $this->search = new $searchType( $this->db ); } @@ -44,7 +44,7 @@ class SearchEngineTest extends MediaWikiLangTestCase { parent::tearDown(); } - public function addDBData() { + public function addDBDataOnce() { if ( !$this->isWikitextNS( NS_MAIN ) ) { // @todo cover the case of non-wikitext content in the main namespace return; @@ -79,7 +79,7 @@ class SearchEngineTest extends MediaWikiLangTestCase { } $this->assertTrue( is_object( $results ) ); - $matches = array(); + $matches = []; $row = $results->next(); while ( $row ) { $matches[] = $row->getTitle()->getPrefixedText(); @@ -96,59 +96,59 @@ class SearchEngineTest extends MediaWikiLangTestCase { public function testFullWidth() { $this->assertEquals( - array( 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ), + [ 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ], $this->fetchIds( $this->search->searchText( 'AZ' ) ), "Search for normalized from Half-width Upper" ); $this->assertEquals( - array( 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ), + [ 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ], $this->fetchIds( $this->search->searchText( 'az' ) ), "Search for normalized from Half-width Lower" ); $this->assertEquals( - array( 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ), + [ 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ], $this->fetchIds( $this->search->searchText( 'AZ' ) ), "Search for normalized from Full-width Upper" ); $this->assertEquals( - array( 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ), + [ 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ], $this->fetchIds( $this->search->searchText( 'az' ) ), "Search for normalized from Full-width Lower" ); } public function testTextSearch() { $this->assertEquals( - array( 'Smithee' ), + [ 'Smithee' ], $this->fetchIds( $this->search->searchText( 'smithee' ) ), "Plain search failed" ); } public function testTextPowerSearch() { - $this->search->setNamespaces( array( 0, 1, 4 ) ); + $this->search->setNamespaces( [ 0, 1, 4 ] ); $this->assertEquals( - array( + [ 'Smithee', 'Talk:Not Main Page', - ), + ], $this->fetchIds( $this->search->searchText( 'smithee' ) ), "Power search failed" ); } public function testTitleSearch() { $this->assertEquals( - array( + [ 'Alan Smithee', 'Smithee', - ), + ], $this->fetchIds( $this->search->searchTitle( 'smithee' ) ), "Title search failed" ); } public function testTextTitlePowerSearch() { - $this->search->setNamespaces( array( 0, 1, 4 ) ); + $this->search->setNamespaces( [ 0, 1, 4 ] ); $this->assertEquals( - array( + [ 'Alan Smithee', 'Smithee', 'Talk:Smithee', - ), + ], $this->fetchIds( $this->search->searchTitle( 'smithee' ) ), "Title power search failed" ); }