Commit graph

216 commits

Author SHA1 Message Date
Sam Reed
82ee95eb92 Attempt to fix tests broken by r105828
Test wanted in a specific order, now just look up wanted array key from title row

Untested as my phpunit tests seem to be b0rked locally :(
2011-12-11 21:49:05 +00:00
Antoine Musso
67aebdd165 clean some files when testing upload
This catch temporary uploaded files which are six characters long.

Follow-up r102458
2011-12-08 14:03:04 +00:00
Antoine Musso
a5639ebd58 clean up whitespace / reindent 2011-12-08 13:02:34 +00:00
Jure Kajzer
69e66bdfe9 * reverted changes to Block and ApiBlockTest made in r102625 ... PEBKAC 2011-11-10 09:36:18 +00:00
Jure Kajzer
be3bbfc539 * Added getInfinity to DatabaseOracle
* Block - replaced 'infinity' strings with DB->getInfinity calls
* UploadStash - added sequence value generation for ID
2011-11-10 07:41:12 +00:00
Platonides
a469cf2c95 Mark as FIXME. This three calls leak a png filename in sys_get_temp_dir() each,
tempnam() like, not the two-words filenames of RandomImageGenerator::getRandomFilenames()
They aren't produced by ApiTestCaseUpload::fakeUploadFile() either.
2011-11-08 22:27:25 +00:00
Alexandre Emsenhuber
1d903f20e6 Pass the (correct) session doApiRequest() 2011-10-28 12:18:43 +00:00
John Du Hart
b0a7defa7f Followup r100905, disabling testGetRollbackToken because it reports as failed on Jenkins but no one can reproduce it. 2011-10-27 21:01:28 +00:00
Alexandre Emsenhuber
681523d5ad Fix for r100905:
* 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()
2011-10-27 18:46:40 +00:00
Antoine Musso
7f2e429c17 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
2011-10-27 10:28:25 +00:00
John Du Hart
998e7c3a86 Followup r100905, fixed the ApiTests 2011-10-27 01:06:50 +00:00
Sam Reed
90e74042b4 Fix comment blocks that start /* to /** 2011-10-11 18:30:50 +00:00
Krinkle
9b9b7df01e Use a username different from the main BlockTest.php, otherwise concurrency errors occur (as seen on Jenkins builds) 2011-09-12 22:18:33 +00:00
Chad Horohoe
a1cd4f0478 rvv (r94406) 2011-08-13 14:00:22 +00:00
Chad Horohoe
6a7172fb99 Purposefully break two tests so I can see how Jenkins reacts to it. Will rv immediately 2011-08-13 13:58:46 +00:00
Chad Horohoe
bb2b97b39d Mostly revert r89400: not needed since Brion fixed the tests in other ways 2011-08-08 16:08:48 +00:00
Chad Horohoe
4a293e11a3 Followup r93928: forgot to remove this 2011-08-04 22:34:26 +00:00
Chad Horohoe
e018780327 Fixes for r92251:
* 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
2011-08-04 22:33:04 +00:00
Chad Horohoe
a11cf96d06 * ApiTest: mark testApiGotCookie() broken, since it is
* ApiTest: partially cleanup testApiListPages() to make it not depend on broken testApiGotCookie(). Not sure what we're testing here, so still marking incomplete.
* ApiWatchTest: mark testWatchClear() as broken rather than skipped due to failing testWatchEdit(). This class needs some love <3
2011-08-02 04:04:03 +00:00
Neil Kandalgaonkar
844ecc5cdb add maxWidth param 2011-08-02 00:36:38 +00:00
Bryan Tong Minh
0cdf9756e8 Add words.txt for us Windows users. This is a random selection of 1000 words from gnuwin32 miscfiles package
Fail more gracefully in RandomImageGenerator
2011-07-15 17:13:24 +00:00
Ian Baker
9d4fd0c567 Refactored UploadStash and related classes to use the database for file metadata storage instead of the session, see bug 26179
Tweaked the UploadWizard to work properly with the new backend code, updated tests
2011-07-12 21:11:43 +00:00
Chad Horohoe
732e3f1271 Remove notes about being destructive. We work properly on cloned tables now 2011-07-06 17:52:27 +00:00
Chad Horohoe
8c5bae9746 Followup r91270: didn't need to be so paranoid about $_SESSION, and actually was causing more issues than it solved. 2011-07-06 16:56:26 +00:00
Antoine Musso
854b84ef42 enhance tests name (for --testdox option) 2011-07-03 18:09:30 +00:00
Antoine Musso
cde767dd89 throw an exception on !is_executable( $wgExiv2Command ) 2011-07-01 18:34:50 +00:00
Chad Horohoe
85a5f0eb85 Merge ApiTestSetup into ApiTestCase and update all subclasses. The amount of duplication here was nasty, and also lets us get rid of a bunch of useless require_once()s.
./phpunit.php --filter Api currently gives me: Tests: 24, Assertions: 107, Incomplete: 1, Skipped: 2.
2011-07-01 16:34:02 +00:00
Chad Horohoe
25bf6f5b43 Fixed a long-standing broken test:
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.
2011-06-30 20:11:45 +00:00
Neil Kandalgaonkar
7c44f1821b create images with orientation (had to use exiv2 hack, imagemagick not helpful) 2011-06-21 03:40:53 +00:00
Neil Kandalgaonkar
89cbb38778 fix invocation of static function 2011-06-18 03:36:44 +00:00
Neil Kandalgaonkar
5c540ab621 generate random triangles (so we can test EXIF orientation, eventually) 2011-06-17 23:26:45 +00:00
Chad Horohoe
cb569f094f Fix some of the weird freaky interaction between ApiBlockTest and BlockTest.
* By using the same summary for both, we allow both sets of tests to pass with --filter Block
* Just testing includes/BlockTest.php still passes
2011-06-03 06:22:18 +00:00
Mark A. Hershberger
a6722cc9aa w/s changes. 2011-06-02 19:32:45 +00:00
Chad Horohoe
f639fcdc4f Test db cleanup
* Fix Oracle stuff per CR on r88755
* Don't expect tests to clean up after themselves, do it in MediaWikiTestCase::run() (skipping user and interwiki, also per CR)
** Also don't do it from the destructor, phpunit calls this more often than you'd think
* Need to find: way to detect "is this the last test?" so we can drop our tables on completion
2011-06-01 22:43:19 +00:00
Antoine Musso
0bbfc95f3c add broken test to broken group (not incomplete)
This test suite really needs to be fixed, marking them as incomplete does not
let us tests them easily.  Instead, I have added them to the Broken group thus
we can easily run them and do not break the continuous integration system.
2011-05-30 18:58:07 +00:00
Antoine Musso
a66e9a7283 ApiBlockTest: delete a block only if it exist
Fix cruise control, follow up r89071
2011-05-28 21:43:06 +00:00
Antoine Musso
2a198b5f06 ApiBlockTest now remove block it creates
This follow up r88755 that make tests depends on each other. The creation
of a Block through the API is troublesome to the BlockTest suite.

Requires r89070
2011-05-28 21:22:29 +00:00
Platonides
fe7ee51f3c Follow up r87210 2011-05-01 23:02:27 +00:00
Mark A. Hershberger
d42259d38c random w/s cleanup 2011-04-23 19:28:35 +00:00
Neil Kandalgaonkar
4ae2a98e13 followup to r85654, move global declarations 2011-04-10 22:27:52 +00:00
Platonides
028a4a8378 Follow up r85566. Add the helper classes to test autoloader. 2011-04-10 16:42:29 +00:00
Neil Kandalgaonkar
33d656ff88 also generate random SVG files 2011-04-07 23:32:36 +00:00
Paul Copperman
f7e6dfb4a3 Various fixes for PHPUnit tests:
* Block.php: Set mExpiry to the value we store in the database, so that Block::equals() returns true. Fixes BlockTest::testInitializerFunctionsReturnCorrectBlock.
* In Title::checkUserBlock(): Convert message parameters to plain strings to make strict comparisons work. Fixes TitlePermissionTest::testUserBlock().
* ApiBlock.php: Follow-Up r85166, add 'Confirm' parameter to data array. Fixes ApiBlockTest::testMakeNormalBlock().
* ApiQueryTest.php: Use $wgMetaNamespace instead of $wgSitename	to account for customizations.
* RandomImageGenerator.php: Use default value for constructor param to prevent fatals.
* ApiTestCaseUpload.php: 
** Fix undefined variable $fileName.
** Remove stray ini_set statements, they don't belong there. Especially ini_set( 'error_reporting', 1 ) will effectively disable all reporting, which makes errors hard to track.
* ArticleTablesTest.php: Put testbug14404() in group Broken, as the fix for the bug has been reverted in r83868.
2011-04-07 14:54:38 +00:00
Mark A. Hershberger
4e9b2c5c53 Apply modification of mdale's patch from Bug #28420: “Re-factor upload tests to support extensions extending upload test case” 2011-04-06 19:50:54 +00:00
Happy-melon
6dbcdc1be0 Blame hashar for this giant commit; he teased me for making so many smaller ones earlier... :D
* Internalise $mAddress/$mUser, $mBy/$mByName, $mEnableAutoblock, $mId as getTarget(), getBlockers(), isAutoblocking(), getId().  
* This required editing AbuseFilter and CheckUser backwards-incompatibly, so push the rest of the changes out to those extensions.
* Attack the evil 14-parameter constructor and gratuitously-confusing newFromDB( $notVeryImportantParameter, $moreImportantParameter)
* Reimplement the hack for bug 13611 in a slightly less fragile fashion; could still do with further cleanup, but then again the login frontend is its own can of worms... :S
* Remove transitionary getTargetAndType() and newFromTargetAndType() methods
* Some optimisation in parseTarget()
* Fix the broken phpunit test mentioned in r84251
2011-03-21 19:12:41 +00:00
Chad Horohoe
b661588c1f Followup r83140: FakeMemCachedClient -> EmptyBagOStuff in tests 2011-03-03 12:55:22 +00:00
Alexandre Emsenhuber
60f1302644 Per Platonides, fix for r82686: make ApiUploadTest work again
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
2011-03-02 12:52:47 +00:00
Mark A. Hershberger
b4cee86beb w/s fixups 2011-02-12 04:06:22 +00:00
Platonides
c220da92bb Mark as needing a Database, as noted in r79532 CR.
It is needed for calling getServerVersion() to provide dbversion
2011-01-13 17:51:25 +00:00
Platonides
1235146be6 Unused global 2011-01-05 23:56:10 +00:00
Platonides
b75be64f49 Follow up r79532. Do not setup a user needlessly. 2011-01-05 19:35:58 +00:00
X!
e23d09cfee Fix r79532: Strct standards 2011-01-04 11:58:17 +00:00
X!
bab978f5d5 Add API query test 2011-01-04 03:22:40 +00:00
X!
ffa443c049 Followup to r79532: Did I really need to implement a parameter? No, I did not. 2011-01-04 01:35:01 +00:00
X!
4e4fa436fa Add API format testing 2011-01-03 21:36:49 +00:00
X!
867c9402be -Add &watchuser option to ApiBlock
-Write tests for ApiBlock
2011-01-02 19:58:27 +00:00
X!
4cce1efbe7 Followup to r79477: Add invalid purge title 2011-01-02 06:15:32 +00:00
X!
cbca0769b7 Add API purge test (mainly as proof of concept for how API tests should be written) 2011-01-02 06:09:58 +00:00
X!
ad6875383b Refactor much of the API testing code.
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.
2011-01-02 05:52:00 +00:00
Platonides
f78ae2a51a Use an autoloader for the tests, following the ideas from r72858.
The SeleniumTestConstants class was added in r79437
2011-01-01 22:04:14 +00:00
X!
2cc065167a Forgot to change the other API tests 2010-12-31 22:34:20 +00:00
X!
a26353ec0b -If $this->db does not exist, skip destroying the DB
-Fix ApiTest errors due to DB rewrite
2010-12-31 21:40:26 +00:00
Chad Horohoe
447529064b * verbose and color default output from phpunit
* Make a bunch of tests subclass MediaWikiTestCase
* Parser tests and ResourceLoaderTest can't subclass it yet due to various issues
2010-12-28 18:17:16 +00:00
X!
eb0611a171 assertType() is deprecated, switching usages tp assertInternalType() and assertInstanceOf() 2010-12-28 15:13:42 +00:00
Platonides
0a59772372 This path changed when moving the tests folder. 2010-12-16 15:09:50 +00:00
Chad Horohoe
23f69f10ed Per wikitech-l discussion: Move tests from maintenance/tests/ to tests/. They're not strictly maintenance scripts, and some people want to do a selective checkout that doesn't include the tests. There's still debate on whether we should include these in the release downloads, but we had a pretty firm consensus to move this. 2010-12-14 16:26:35 +00:00