r76805 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76804‎ | r76805 | r76806 >
Date:16:06, 16 November 2010
Author:maxsem
Status:deferred (Comments)
Tags:
Comment:
Fixed SearchUpdateTest, it doesn't mess with database anymore. More fixes in the line of r76617.
Modified paths:
  • /trunk/phase3/maintenance/tests/phpunit/includes/LocalFileTest.php (modified) (history)
  • /trunk/phase3/maintenance/tests/phpunit/includes/search/SearchDbTest.php (modified) (history)
  • /trunk/phase3/maintenance/tests/phpunit/includes/search/SearchUpdateTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/phpunit/includes/LocalFileTest.php
@@ -25,11 +25,6 @@
2626 $this->file_lc = $this->repo_lc->newFile( 'test!' );
2727 }
2828
29 - function tearDown() {
30 - global $wgContLang;
31 - unset( $wgContLang );
32 - }
33 -
3429 function testGetHashPath() {
3530 $this->assertEquals( '', $this->file_hl0->getHashPath() );
3631 $this->assertEquals( 'a/a2/', $this->file_hl2->getHashPath() );
Index: trunk/phase3/maintenance/tests/phpunit/includes/search/SearchDbTest.php
@@ -31,7 +31,6 @@
3232 function tearDown() {
3333 $this->removeSearchData();
3434 unset( $this->search );
35 - $GLOBALS['wgContLang'] = null;
3635 }
3736 }
3837
Index: trunk/phase3/maintenance/tests/phpunit/includes/search/SearchUpdateTest.php
@@ -1,33 +1,5 @@
22 <?php
33
4 -class DatabaseMock extends DatabaseBase {
5 - function __construct( $server = false, $user = false, $password = false, $dbName = false,
6 - $flags = 0, $tablePrefix = 'get from global' )
7 - {
8 - $this->mConn = true;
9 - $this->mOpened = true;
10 - }
11 -
12 - function open( $server, $user, $password, $dbName ) { return true; }
13 - function doQuery( $sql ) { }
14 - function fetchObject( $res ) { }
15 - function fetchRow( $res ) { }
16 - function numRows( $res ) { }
17 - function numFields( $res ) { }
18 - function fieldName( $res, $n ) { }
19 - function insertId() { }
20 - function dataSeek( $res, $row ) { }
21 - function lastErrno() { return 0; }
22 - function lastError() { return ''; }
23 - function affectedRows() { }
24 - function fieldInfo( $table, $field ) { }
25 - function strencode( $s ) { }
26 - static function getSoftwareLink() { }
27 - function getServerVersion() { }
28 - function getType() { }
29 - function getSearchEngine() { }
30 -}
31 -
324 class MockSearch extends SearchEngine {
335 public static $id;
346 public static $title;
@@ -44,15 +16,11 @@
4517 }
4618
4719 /**
48 - * @group Broken
4920 * Disabled until we're able to run it without messing with LoadBalancer and breaking
5021 * other tests in a sneaky way
5122 */
5223 class SearchUpdateTest extends PHPUnit_Framework_TestCase {
5324 static $searchType;
54 - static $dbtype;
55 - static $factoryconf;
56 - static $dbservers;
5725
5826 function update( $text, $title = 'Test', $id = 1 ) {
5927 $u = new SearchUpdate( $id, $title, $text );
@@ -67,32 +35,16 @@
6836 }
6937
7038 function setUp() {
71 - global $wgSearchType, $wgDBtype, $wgLBFactoryConf, $wgDBservers, $wgContLang;
 39+ global $wgSearchType;
7240
7341 self::$searchType = $wgSearchType;
74 - self::$dbtype = $wgDBtype;
75 - self::$factoryconf = $wgLBFactoryConf;
76 - self::$dbservers = $wgDBservers;
77 -
7842 $wgSearchType = 'MockSearch';
79 - $wgDBtype = 'mock';
80 - $wgLBFactoryConf['class'] = 'LBFactory_Simple';
81 - $wgDBservers = null;
82 -
83 - # We need to reset the LoadBalancer in order to bypass its cache and get the mock db
84 - wfGetLBFactory()->destroyInstance();
85 - $wgContLang = Language::factory( 'en' );
8643 }
8744
8845 function tearDown() {
89 - global $wgSearchType, $wgDBtype, $wgLBFactoryConf, $wgDBservers, $wgContLang;
 46+ global $wgSearchType;
9047
9148 $wgSearchType = self::$searchType;
92 - $wgDBtype = self::$dbtype;
93 - $wgLBFactoryConf = self::$factoryconf;
94 - $wgDBservers = self::$dbservers;
95 -
96 - wfGetLBFactory()->destroyInstance();
9749 }
9850
9951 function testUpdateText() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r76809Follow-up r76805: removed outdated comment, introduced new group "Search"maxsem16:54, 16 November 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76617Tests: removed assignments of null to globals that are usually not null in te...maxsem08:32, 13 November 2010

Comments

#Comment by Platonides (talk | contribs)   16:52, 16 November 2010

Removing @group Broken the rest of the comment is no longer true.

#Comment by MaxSem (talk | contribs)   16:55, 16 November 2010

Thanks, fixed in r76809.

Status & tagging log