Index: trunk/phase3/tests/phpunit/MediaWikiTestCase.php |
— | — | @@ -132,6 +132,10 @@ |
133 | 133 | //Temporary tables seem to be broken ATM, delete anyway |
134 | 134 | } |
135 | 135 | |
| 136 | + if( is_null( $this->db ) ) { |
| 137 | + return; |
| 138 | + } |
| 139 | + |
136 | 140 | if( $this->db->getType() == 'oracle' ) { |
137 | 141 | $tables = $this->db->listTables( 'ut_', __METHOD__ ); |
138 | 142 | } |
Index: trunk/phase3/tests/phpunit/includes/api/ApiTest.php |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | */ |
81 | 81 | function testApiLoginNoName() { |
82 | 82 | $data = $this->doApiRequest( array( 'action' => 'login', |
83 | | - 'lgname' => '', 'lgpassword' => self::$user->password, |
| 83 | + 'lgname' => '', 'lgpassword' => $this->user->password, |
84 | 84 | ) ); |
85 | 85 | $this->assertEquals( 'NoName', $data[0]['login']['result'] ); |
86 | 86 | } |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | function testApiLoginBadPass() { |
89 | 89 | global $wgServer; |
90 | 90 | |
91 | | - $user = self::$user; |
| 91 | + $user = $this->user; |
92 | 92 | |
93 | 93 | if ( !isset( $wgServer ) ) { |
94 | 94 | $this->markTestIncomplete( 'This test needs $wgServer to be set in LocalSettings.php' ); |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | $this->markTestIncomplete( 'This test needs $wgServer to be set in LocalSettings.php' ); |
132 | 132 | } |
133 | 133 | |
134 | | - $user = self::$user; |
| 134 | + $user = $this->user; |
135 | 135 | |
136 | 136 | $ret = $this->doApiRequest( array( |
137 | 137 | "action" => "login", |
— | — | @@ -174,8 +174,8 @@ |
175 | 175 | $req = MWHttpRequest::factory( self::$apiUrl . "?action=login&format=xml", |
176 | 176 | array( "method" => "POST", |
177 | 177 | "postData" => array( |
178 | | - "lgname" => self::$user->userName, |
179 | | - "lgpassword" => self::$user->password ) ) ); |
| 178 | + "lgname" => $this->user->userName, |
| 179 | + "lgpassword" => $this->user->password ) ) ); |
180 | 180 | $req->execute(); |
181 | 181 | |
182 | 182 | libxml_use_internal_errors( true ); |
— | — | @@ -190,8 +190,8 @@ |
191 | 191 | |
192 | 192 | $req->setData( array( |
193 | 193 | "lgtoken" => $token, |
194 | | - "lgname" => self::$user->userName, |
195 | | - "lgpassword" => self::$user->password ) ); |
| 194 | + "lgname" => $this->user->userName, |
| 195 | + "lgpassword" => $this->user->password ) ); |
196 | 196 | $req->execute(); |
197 | 197 | |
198 | 198 | $cj = $req->getCookieJar(); |
— | — | @@ -199,7 +199,7 @@ |
200 | 200 | $this->assertNotEquals( false, $serverName ); |
201 | 201 | $serializedCookie = $cj->serializeToHttpRequest( $wgScriptPath, $serverName ); |
202 | 202 | $this->assertNotEquals( '', $serializedCookie ); |
203 | | - $this->assertRegexp( '/_session=[^;]*; .*UserID=[0-9]*; .*UserName=' . self::$user->userName . '; .*Token=/', $serializedCookie ); |
| 203 | + $this->assertRegexp( '/_session=[^;]*; .*UserID=[0-9]*; .*UserName=' . $this->user->userName . '; .*Token=/', $serializedCookie ); |
204 | 204 | |
205 | 205 | return $cj; |
206 | 206 | } |
Index: trunk/phase3/tests/phpunit/includes/api/ApiSetup.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | abstract class ApiTestSetup extends MediaWikiTestCase { |
5 | | - protected static $user; |
6 | | - protected static $sysopUser; |
| 5 | + protected $user; |
| 6 | + protected $sysopUser; |
7 | 7 | protected static $apiUrl; |
8 | 8 | |
9 | 9 | function setUp() { |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | $wgContLang = Language::factory( 'en' ); |
16 | 16 | $wgAuth = new StubObject( 'wgAuth', 'AuthPlugin' ); |
17 | 17 | $wgRequest = new FauxRequest( array() ); |
18 | | - self::setupUser(); |
| 18 | + $this->setupUser(); |
19 | 19 | } |
20 | 20 | |
21 | 21 | protected function doApiRequest( $params, $data = null ) { |
— | — | @@ -31,13 +31,13 @@ |
32 | 32 | return $data; |
33 | 33 | } |
34 | 34 | |
35 | | - static function setupUser() { |
36 | | - if ( self::$user == null || self::$sysopUser == null ) { |
37 | | - self::$user = new UserWrapper( 'User for MediaWiki automated tests', User::randomPassword() ); |
38 | | - self::$sysopUser = new UserWrapper( 'Sysop for MediaWiki automated tests', User::randomPassword(), 'sysop' ); |
| 35 | + function setupUser() { |
| 36 | + if ( $this->user == null || $this->sysopUser == null ) { |
| 37 | + $this->user = new UserWrapper( 'User for MediaWiki automated tests', User::randomPassword() ); |
| 38 | + $this->sysopUser = new UserWrapper( 'Sysop for MediaWiki automated tests', User::randomPassword(), 'sysop' ); |
39 | 39 | } |
40 | 40 | |
41 | | - $GLOBALS['wgUser'] = self::$sysopUser->user; |
| 41 | + $GLOBALS['wgUser'] = $this->sysopUser->user; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |