From: Max Semenik Date: Tue, 16 Nov 2010 16:06:46 +0000 (+0000) Subject: Fixed SearchUpdateTest, it doesn't mess with database anymore. More fixes in the... X-Git-Tag: 1.31.0-rc.0~33856 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=cac0b5af9c7952cc6b0ed364ed69a99e6c453ecc;p=lhc%2Fweb%2Fwiklou.git Fixed SearchUpdateTest, it doesn't mess with database anymore. More fixes in the line of r76617. --- diff --git a/maintenance/tests/phpunit/includes/LocalFileTest.php b/maintenance/tests/phpunit/includes/LocalFileTest.php index 29682b18b5..32aa51579c 100644 --- a/maintenance/tests/phpunit/includes/LocalFileTest.php +++ b/maintenance/tests/phpunit/includes/LocalFileTest.php @@ -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() ); diff --git a/maintenance/tests/phpunit/includes/search/SearchDbTest.php b/maintenance/tests/phpunit/includes/search/SearchDbTest.php index fb2bcc1742..0293a229b4 100644 --- a/maintenance/tests/phpunit/includes/search/SearchDbTest.php +++ b/maintenance/tests/phpunit/includes/search/SearchDbTest.php @@ -31,7 +31,6 @@ class SearchDbTest extends SearchEngineTest { function tearDown() { $this->removeSearchData(); unset( $this->search ); - $GLOBALS['wgContLang'] = null; } } diff --git a/maintenance/tests/phpunit/includes/search/SearchUpdateTest.php b/maintenance/tests/phpunit/includes/search/SearchUpdateTest.php index 9295ac71b8..1f12ead2b3 100644 --- a/maintenance/tests/phpunit/includes/search/SearchUpdateTest.php +++ b/maintenance/tests/phpunit/includes/search/SearchUpdateTest.php @@ -1,33 +1,5 @@ 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() {