ApiUploadTest gives inconsistent results which trigger false alamrs to all
the ops team. We are disabling those tests for now.
See https://bugzilla.wikimedia.org/26169
tempnam() like, not the two-words filenames of RandomImageGenerator::getRandomFilenames()
They aren't produced by ApiTestCaseUpload::fakeUploadFile() either.
* Make tests work again
* Added ApiTestCase::doApiRequest() and related to pass it to the context and removed override of $wgUser where possible
* Fix ApiLogin to get the correct User object (i.e. the logged in one)
* Fix ApiBase to feed a RequestContext to setContext() so that ApiLogin can call setUser()
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
* Move Imagick check into getImageWriteMethod(), adjust exception catching. Previously this was bailing on the test if you have convert but not the PHP Imagick extension. Now all these tests are passing for me again.
* Rm unused member variable, whitespace, etc
1) ApiUploadTest::testUploadStash
Failed asserting that <boolean:true> is false.
Did this by copying the correct stuff from $_SESSION to our local $session we're using for the test. Not sure if this is strictly correct, but hey it passes ;-)
Currently at: Tests: 1622, Assertions: 32090, Incomplete: 8, Skipped: 5.
Added option request parameter to User::editToken() and User::matchEditToken() and use them where possible from the api.
Also removed $_SESSION usage since it's no longer needed
Old: ApiWatchTest not only tested the watch module, but also tested the login module,
and the login module test was also used to log in to the API for the other tests.
New: ApiWatchTest only contains watch-specific methods. The login testing has been moved
to ApiTest. The code used to log in and get tokens have been moved to ApiSetup. Nice,
organized, and much nicer than before. ApiUploadTest is still pretty fugly, though.