r83375 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83374‎ | r83375 | r83376 >
Date:09:01, 6 March 2011
Author:maxsem
Status:ok
Tags:
Comment:
Fixed fatals in UploadFromUrlTest. It still fails though
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/UploadFromUrlTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/UploadFromUrlTest.php
@@ -4,6 +4,7 @@
55
66 /**
77 * @group Broken
 8+ * @group Upload
89 */
910 class UploadFromUrlTest extends ApiTestSetup {
1011
@@ -52,8 +53,8 @@
5354 public function testLogin() {
5455 $data = $this->doApiRequest( array(
5556 'action' => 'login',
56 - 'lgname' => self::$userName,
57 - 'lgpassword' => self::$passWord ) );
 57+ 'lgname' => $this->user->userName,
 58+ 'lgpassword' => $this->user->passWord ) );
5859 $this->assertArrayHasKey( "login", $data[0] );
5960 $this->assertArrayHasKey( "result", $data[0]['login'] );
6061 $this->assertEquals( "NeedToken", $data[0]['login']['result'] );
@@ -62,8 +63,8 @@
6364 $data = $this->doApiRequest( array(
6465 'action' => 'login',
6566 "lgtoken" => $token,
66 - "lgname" => self::$userName,
67 - "lgpassword" => self::$passWord ) );
 67+ 'lgname' => $this->user->userName,
 68+ 'lgpassword' => $this->user->passWord ) );
6869
6970 $this->assertArrayHasKey( "login", $data[0] );
7071 $this->assertArrayHasKey( "result", $data[0]['login'] );
@@ -78,7 +79,7 @@
7980 * @depends testClearQueue
8081 */
8182 public function testSetupUrlDownload( $data ) {
82 - $token = self::$user->editToken();
 83+ $token = $this->user->editToken();
8384 $exception = false;
8485
8586 try {
@@ -117,7 +118,7 @@
118119 }
119120 $this->assertTrue( $exception, "Got exception" );
120121
121 - self::$user->removeGroup( 'sysop' );
 122+ $this->user->removeGroup( 'sysop' );
122123 $exception = false;
123124 try {
124125 $this->doApiRequest( array(
@@ -132,7 +133,7 @@
133134 }
134135 $this->assertTrue( $exception, "Got exception" );
135136
136 - self::$user->addGroup( 'sysop' );
 137+ $this->user->addGroup( 'sysop' );
137138 $data = $this->doApiRequest( array(
138139 'action' => 'upload',
139140 'url' => 'http://bits.wikimedia.org/skins-1.5/common/images/poweredby_mediawiki_88x31.png',
@@ -152,9 +153,9 @@
153154 * @depends testClearQueue
154155 */
155156 public function testAsyncUpload( $data ) {
156 - $token = self::$user->editToken();
 157+ $token = $this->user->editToken();
157158
158 - self::$user->addGroup( 'users' );
 159+ $this->user->addGroup( 'users' );
159160
160161 $data = $this->doAsyncUpload( $token, true );
161162 $this->assertEquals( $data[0]['upload']['result'], 'Success' );
@@ -171,9 +172,9 @@
172173 * @depends testClearQueue
173174 */
174175 public function testAsyncUploadWarning( $data ) {
175 - $token = self::$user->editToken();
 176+ $token = $this->user->editToken();
176177
177 - self::$user->addGroup( 'users' );
 178+ $this->user->addGroup( 'users' );
178179
179180
180181 $data = $this->doAsyncUpload( $token );
@@ -202,12 +203,12 @@
203204 * @depends testClearQueue
204205 */
205206 public function testSyncDownload( $data ) {
206 - $token = self::$user->editToken();
 207+ $token = $this->user->editToken();
207208
208209 $job = Job::pop();
209210 $this->assertFalse( $job, 'Starting with an empty jobqueue' );
210211
211 - self::$user->addGroup( 'users' );
 212+ $this->user->addGroup( 'users' );
212213 $data = $this->doApiRequest( array(
213214 'action' => 'upload',
214215 'filename' => 'UploadFromUrlTest.png',
@@ -226,9 +227,9 @@
227228 }
228229
229230 public function testLeaveMessage() {
230 - $token = self::$user->editToken();
 231+ $token = $this->user->user->editToken();
231232
232 - $talk = self::$user->getTalkPage();
 233+ $talk = $this->user->user->getTalkPage();
233234 if ( $talk->exists() ) {
234235 $a = new Article( $talk );
235236 $a->doDeleteArticle( '' );

Status & tagging log