Fixed SearchUpdateTest, it doesn't mess with database anymore. More fixes in the...
authorMax Semenik <maxsem@users.mediawiki.org>
Tue, 16 Nov 2010 16:06:46 +0000 (16:06 +0000)
committerMax Semenik <maxsem@users.mediawiki.org>
Tue, 16 Nov 2010 16:06:46 +0000 (16:06 +0000)
maintenance/tests/phpunit/includes/LocalFileTest.php
maintenance/tests/phpunit/includes/search/SearchDbTest.php
maintenance/tests/phpunit/includes/search/SearchUpdateTest.php

index 29682b1..32aa515 100644 (file)
@@ -25,11 +25,6 @@ class LocalFileTest extends PHPUnit_Framework_TestCase {
                $this->file_lc = $this->repo_lc->newFile( 'test!' );
        }
 
-       function tearDown() {
-               global $wgContLang;
-               unset( $wgContLang );
-       }
-
        function testGetHashPath() {
                $this->assertEquals( '', $this->file_hl0->getHashPath() );
                $this->assertEquals( 'a/a2/', $this->file_hl2->getHashPath() );
index fb2bcc1..0293a22 100644 (file)
@@ -31,7 +31,6 @@ class SearchDbTest extends SearchEngineTest {
        function tearDown() {
                $this->removeSearchData();
                unset( $this->search );
-               $GLOBALS['wgContLang'] = null;
        }
 }
 
index 9295ac7..1f12ead 100644 (file)
@@ -1,33 +1,5 @@
 <?php
 
-class DatabaseMock extends DatabaseBase {
-       function __construct( $server = false, $user = false, $password = false, $dbName = false,
-               $flags = 0, $tablePrefix = 'get from global' )
-       {
-               $this->mConn = true;
-               $this->mOpened = true;
-       }
-
-       function open( $server, $user, $password, $dbName ) { return true; }
-       function doQuery( $sql ) { }
-       function fetchObject( $res ) { }
-       function fetchRow( $res ) { }
-       function numRows( $res ) { }
-       function numFields( $res ) { }
-       function fieldName( $res, $n ) { }
-       function insertId() { }
-       function dataSeek( $res, $row ) { }
-       function lastErrno() { return 0; }
-       function lastError() { return ''; }
-       function affectedRows() { }
-       function fieldInfo( $table, $field ) { }
-       function strencode( $s ) { }
-       static function getSoftwareLink() { }
-       function getServerVersion() { }
-       function getType() { }
-       function getSearchEngine() { }
-}
-
 class MockSearch extends SearchEngine {
        public static $id;
        public static $title;
@@ -44,15 +16,11 @@ class MockSearch extends SearchEngine {
 }
 
 /**
- * @group Broken
  * Disabled until we're able to run it without messing with LoadBalancer and breaking 
  * other tests in a sneaky way
  */
 class SearchUpdateTest extends PHPUnit_Framework_TestCase {
        static $searchType;
-       static $dbtype;
-       static $factoryconf;
-       static $dbservers;
 
        function update( $text, $title = 'Test', $id = 1 ) {
                $u = new SearchUpdate( $id, $title, $text );
@@ -67,32 +35,16 @@ class SearchUpdateTest extends PHPUnit_Framework_TestCase {
        }
 
        function setUp() {
-               global $wgSearchType, $wgDBtype, $wgLBFactoryConf, $wgDBservers, $wgContLang;
+               global $wgSearchType;
 
                self::$searchType  = $wgSearchType;
-               self::$dbtype      = $wgDBtype;
-               self::$factoryconf = $wgLBFactoryConf;
-               self::$dbservers   = $wgDBservers;
-
                $wgSearchType = 'MockSearch';
-               $wgDBtype = 'mock';
-               $wgLBFactoryConf['class'] = 'LBFactory_Simple';
-               $wgDBservers = null;
-
-               # We need to reset the LoadBalancer in order to bypass its cache and get the mock db
-               wfGetLBFactory()->destroyInstance();
-               $wgContLang = Language::factory( 'en' );
        }
 
        function tearDown() {
-               global $wgSearchType, $wgDBtype, $wgLBFactoryConf, $wgDBservers, $wgContLang;
+               global $wgSearchType;
 
                $wgSearchType = self::$searchType;
-               $wgDBtype = self::$dbtype;
-               $wgLBFactoryConf = self::$factoryconf;
-               $wgDBservers = self::$dbservers;
-
-               wfGetLBFactory()->destroyInstance();
        }
 
        function testUpdateText() {