Merge SearchDbTest into SearchEngineTest. No real need for two classes here anymore...
authorChad Horohoe <demon@users.mediawiki.org>
Tue, 28 Jun 2011 22:26:22 +0000 (22:26 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Tue, 28 Jun 2011 22:26:22 +0000 (22:26 +0000)
Also did some misc. cleanup while I was here

Results: OK (5 tests, 16 assertions)

tests/phpunit/includes/search/SearchDbTest.php [deleted file]
tests/phpunit/includes/search/SearchEngineTest.php

diff --git a/tests/phpunit/includes/search/SearchDbTest.php b/tests/phpunit/includes/search/SearchDbTest.php
deleted file mode 100644 (file)
index 753d08e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-require_once( dirname( __FILE__ ) . '/SearchEngineTest.php' );
-
-/**
- * @group Search
- * @group Database
- * @group Destructive
- */
-class SearchDbTest extends SearchEngineTest {
-       var $db;
-
-       function setUp() {
-               // Get a database connection or skip test
-               $this->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 );
-       }
-}
-
-
index e59a8bf..1a0fcd3 100644 (file)
@@ -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 ) );