From 41b8ec60319369b73de5d86fcb365040d20a023d Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 28 Jun 2011 22:26:22 +0000 Subject: [PATCH] Merge SearchDbTest into SearchEngineTest. No real need for two classes here anymore, and it's kind of confusing if you try to run the stub by itself. Also did some misc. cleanup while I was here Results: OK (5 tests, 16 assertions) --- .../phpunit/includes/search/SearchDbTest.php | 35 ------------------- .../includes/search/SearchEngineTest.php | 24 ++++++------- 2 files changed, 11 insertions(+), 48 deletions(-) delete mode 100644 tests/phpunit/includes/search/SearchDbTest.php diff --git a/tests/phpunit/includes/search/SearchDbTest.php b/tests/phpunit/includes/search/SearchDbTest.php deleted file mode 100644 index 753d08e4f5..0000000000 --- a/tests/phpunit/includes/search/SearchDbTest.php +++ /dev/null @@ -1,35 +0,0 @@ -db = wfGetDB( DB_MASTER ); - if ( !$this->db ) { - $this->markTestIncomplete( "Can't find a database to test with." ); - } - - parent::setup(); - - // Initialize search database with data - $GLOBALS['wgContLang'] = new Language; - $this->insertSearchData(); - $searchType = $this->db->getSearchEngine(); - $this->search = new $searchType( $this->db ); - } - - function tearDown() { - $this->removeSearchData(); - unset( $this->search ); - } -} - - diff --git a/tests/phpunit/includes/search/SearchEngineTest.php b/tests/phpunit/includes/search/SearchEngineTest.php index e59a8bfd94..1a0fcd311b 100644 --- a/tests/phpunit/includes/search/SearchEngineTest.php +++ b/tests/phpunit/includes/search/SearchEngineTest.php @@ -3,17 +3,21 @@ /** * This class is not directly tested. Instead it is extended by SearchDbTest. * @group Search - * @group Stub - * @group Destructive + * @group Database */ class SearchEngineTest extends MediaWikiTestCase { - var $db, $search, $pageList; + protected $search, $pageList; + + function tearDown() { + unset( $this->search ); + } /* * Checks for database type & version. * Will skip current test if DB does not support search. */ function setUp() { + parent::setUp(); // Search tests require MySQL or SQLite with FTS # Get database type and version $dbType = $this->db->getType(); @@ -24,13 +28,16 @@ class SearchEngineTest extends MediaWikiTestCase { if( !$dbSupported ) { $this->markTestSkipped( "MySQL or SQLite with FTS3 only" ); } + + $searchType = $this->db->getSearchEngine(); + $this->search = new $searchType( $this->db ); } function pageExists( $title ) { return false; } - function insertSearchData() { + function addDBData() { if ( $this->pageExists( 'Not_Main_Page' ) ) { return; } @@ -53,15 +60,6 @@ class SearchEngineTest extends MediaWikiTestCase { $this->insertPage( 'DomainName', 'example.com', 0 ); } - function removeSearchData() { - return; - /*while ( count( $this->pageList ) ) { - list( $title, $id ) = array_pop( $this->pageList ); - $article = new Article( $title, $id ); - $article->doDeleteArticle( "Search Test" ); - }*/ - } - function fetchIds( $results ) { $this->assertTrue( is_object( $results ) ); -- 2.20.1