http://www.mediawiki.org/wiki/Special:Code/MediaWiki/91027

Revision: 91027
Author:   demon
Date:     2011-06-28 22:26:22 +0000 (Tue, 28 Jun 2011)
Log Message:
-----------
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)

Modified Paths:
--------------
    trunk/phase3/tests/phpunit/includes/search/SearchEngineTest.php

Removed Paths:
-------------
    trunk/phase3/tests/phpunit/includes/search/SearchDbTest.php

Deleted: trunk/phase3/tests/phpunit/includes/search/SearchDbTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/search/SearchDbTest.php 2011-06-28 
22:20:06 UTC (rev 91026)
+++ trunk/phase3/tests/phpunit/includes/search/SearchDbTest.php 2011-06-28 
22:26:22 UTC (rev 91027)
@@ -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 );
-       }
-}
-
-

Modified: trunk/phase3/tests/phpunit/includes/search/SearchEngineTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/search/SearchEngineTest.php     
2011-06-28 22:20:06 UTC (rev 91026)
+++ trunk/phase3/tests/phpunit/includes/search/SearchEngineTest.php     
2011-06-28 22:26:22 UTC (rev 91027)
@@ -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 @@
                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 @@
                $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 ) );
 


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to