r100959 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100958‎ | r100959 | r100960 >
Date:10:28, 27 October 2011
Author:hashar
Status:ok
Tags:
Comment:
we must have a session when testing Api upload.

For some reason, the ApiUploadTest::testLogin method no more returns a valid
session. Since most, if not all, of the ApiUploadTest tests depends on it
we want that testLogin method to fail so we can skip the rest of the tests.

Test command:
./phpunit.php --filter ApiUpload --tap

BEFORE:
=======

TAP version 13
array(0) {
}
ok 1 - ApiUploadTest::testLogin
ok 2 - ApiUploadTest::testUploadRequiresToken
not ok 3 - Error: ApiUploadTest::testUploadMissingParams
not ok 4 - Error: ApiUploadTest::testUpload
^C

AFTER:
======

TAP version 13
not ok 1 - Failure: ApiUploadTest::testLogin
---
message: 'API Login must return a session'
severity: fail
...
ok 1 - # SKIP This test depends on "ApiUploadTest::testLogin" to pass.
ok 1 - # SKIP This test depends on "ApiUploadTest::testLogin" to pass.
^C ... more skips
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/api/ApiUploadTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/api/ApiUploadTest.php
@@ -54,6 +54,7 @@
5555 $this->assertEquals( "Success", $result['login']['result'] );
5656 $this->assertArrayHasKey( 'lgtoken', $result['login'] );
5757
 58+ $this->assertNotEmpty( $session, 'API Login must return a session' );
5859 return $session;
5960
6061 }

Status & tagging log