X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsearch%2FSearchEngineTest.php;h=6abca6d4a1cf2d0d62717c430f7aa014d00dd149;hb=6c5c306699539e8684a14608df0fedbc950c824e;hp=395e1a04bffe95249db0d82f2d16f85f7cb75da5;hpb=68f25d6b8a2464de3a10bfe06fc31b33a5d976e7;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/search/SearchEngineTest.php b/tests/phpunit/includes/search/SearchEngineTest.php index 395e1a04bf..6abca6d4a1 100644 --- a/tests/phpunit/includes/search/SearchEngineTest.php +++ b/tests/phpunit/includes/search/SearchEngineTest.php @@ -4,7 +4,7 @@ * @group Search * @group Database */ -class SearchEngineTest extends MediaWikiTestCase { +class SearchEngineTest extends MediaWikiLangTestCase { protected $search, $pageList; /** @@ -13,14 +13,15 @@ class SearchEngineTest extends MediaWikiTestCase { */ protected function setUp() { parent::setUp(); + // Search tests require MySQL or SQLite with FTS # Get database type and version $dbType = $this->db->getType(); $dbSupported = - ($dbType === 'mysql') - || ( $dbType === 'sqlite' && $this->db->getFulltextSearchModule() == 'FTS3' ); + ( $dbType === 'mysql' ) + || ( $dbType === 'sqlite' && $this->db->getFulltextSearchModule() == 'FTS3' ); - if( !$dbSupported ) { + if ( !$dbSupported ) { $this->markTestSkipped( "MySQL or SQLite with FTS3 only" ); } @@ -30,6 +31,8 @@ class SearchEngineTest extends MediaWikiTestCase { protected function tearDown() { unset( $this->search ); + + parent::tearDown(); } function pageExists( $title ) { @@ -46,29 +49,29 @@ class SearchEngineTest extends MediaWikiTestCase { return; } - $this->insertPage( "Not_Main_Page", "This is not a main page", 0 ); - $this->insertPage( 'Talk:Not_Main_Page', 'This is not a talk page to the main page, see [[smithee]]', 1 ); - $this->insertPage( 'Smithee', 'A smithee is one who smiths. See also [[Alan Smithee]]', 0 ); - $this->insertPage( 'Talk:Smithee', 'This article sucks.', 1 ); - $this->insertPage( 'Unrelated_page', 'Nothing in this page is about the S word.', 0 ); - $this->insertPage( 'Another_page', 'This page also is unrelated.', 0 ); - $this->insertPage( 'Help:Help', 'Help me!', 4 ); - $this->insertPage( 'Thppt', 'Blah blah', 0 ); - $this->insertPage( 'Alan_Smithee', 'yum', 0 ); - $this->insertPage( 'Pages', 'are\'food', 0 ); - $this->insertPage( 'HalfOneUp', 'AZ', 0 ); - $this->insertPage( 'FullOneUp', 'AZ', 0 ); - $this->insertPage( 'HalfTwoLow', 'az', 0 ); - $this->insertPage( 'FullTwoLow', 'az', 0 ); - $this->insertPage( 'HalfNumbers', '1234567890', 0 ); - $this->insertPage( 'FullNumbers', '1234567890', 0 ); - $this->insertPage( 'DomainName', 'example.com', 0 ); + $this->insertPage( "Not_Main_Page", "This is not a main page", 0 ); + $this->insertPage( 'Talk:Not_Main_Page', 'This is not a talk page to the main page, see [[smithee]]', 1 ); + $this->insertPage( 'Smithee', 'A smithee is one who smiths. See also [[Alan Smithee]]', 0 ); + $this->insertPage( 'Talk:Smithee', 'This article sucks.', 1 ); + $this->insertPage( 'Unrelated_page', 'Nothing in this page is about the S word.', 0 ); + $this->insertPage( 'Another_page', 'This page also is unrelated.', 0 ); + $this->insertPage( 'Help:Help', 'Help me!', 4 ); + $this->insertPage( 'Thppt', 'Blah blah', 0 ); + $this->insertPage( 'Alan_Smithee', 'yum', 0 ); + $this->insertPage( 'Pages', 'are\'food', 0 ); + $this->insertPage( 'HalfOneUp', 'AZ', 0 ); + $this->insertPage( 'FullOneUp', 'AZ', 0 ); + $this->insertPage( 'HalfTwoLow', 'az', 0 ); + $this->insertPage( 'FullTwoLow', 'az', 0 ); + $this->insertPage( 'HalfNumbers', '1234567890', 0 ); + $this->insertPage( 'FullNumbers', '1234567890', 0 ); + $this->insertPage( 'DomainName', 'example.com', 0 ); } function fetchIds( $results ) { if ( !$this->isWikitextNS( NS_MAIN ) ) { $this->markTestIncomplete( __CLASS__ . " does no yet support non-wikitext content " - . "in the main namespace"); + . "in the main namespace" ); } $this->assertTrue( is_object( $results ) ); @@ -132,9 +135,9 @@ class SearchEngineTest extends MediaWikiTestCase { function testTextSearch() { $this->assertEquals( - array( 'Smithee' ), - $this->fetchIds( $this->search->searchText( 'smithee' ) ), - "Plain search failed" ); + array( 'Smithee' ), + $this->fetchIds( $this->search->searchText( 'smithee' ) ), + "Plain search failed" ); } function testTextPowerSearch() {