Commit graph

66 commits

Author SHA1 Message Date
jeroendedauw
5356dbd180 Switch on expected value, since the actual one can obviously be wrong
This gets rid of confusing error messages pointing to the provided type being invalid

Change-Id: Id283ef6e8fa6c3f18bc9ef3b740e8ec4bd181e3a
2012-09-24 15:15:43 +02:00
Daniel Kinzler
e1dc9e8723 Merge "Added MediaWikiTestCase::assertTypeOrValue to facilitate common type checks" 2012-09-14 10:08:44 +00:00
Siebrand Mazeland
59ec5a325c Move api/ApiTestUser.php to TestUser.php and make available in MediaWikiTestCase class.
* Renamed class ApiTestUser to TestUser.

Change-Id: I1c3c659c3ba5c54a314d879132f760008983372d
2012-09-13 18:40:23 +00:00
jeroendedauw
ad6ccbcaf3 Added MediaWikiTestCase::assertTypeOrValue to facilitate common type checks
Also added MediaWikiTestCase::assertType which accepts both internal types, classes and interfaces

Change-Id: I168ef17ad2da3b744a106742760ef34cc683bf69
2012-09-13 20:22:03 +02:00
Antoine Musso
19d5ab2e8a test: new assertHTMLEquals()
Very trivial helper to compare HTML content. The method just add a
newline after each closing angle and then call assertEquals().

Change-Id: I5e6daa916a4fb452824616fa3c8a87bdb8038e8c
2012-09-03 10:47:36 +02:00
daniel
167bea7e7e Clean up transactions after test.
MediaWikiTestCase::teardown() will now rollback any transactions
left open by a test case. This is intended to make sure tests do
not provide "interesting" results casued by transaction state
leaking from other tests.

Change-Id: Ia225251efd5aafbaa6674e2732ab1ba7761bfadc
2012-08-27 14:38:25 +02:00
Aaron Schulz
d996871d6b Merge "Added utility method taking an array of elements and wrapping each element in it's own array." 2012-08-14 03:25:13 +00:00
Aaron Schulz
b701eb0713 Merge "Move method to its using test class rather then having a public static thing in the base test class" 2012-08-13 20:14:19 +00:00
Aaron Schulz
c638ca1914 Merge "Fix for assertArrayEquals. Was throwing fatal for object elements" 2012-08-13 20:09:10 +00:00
jeroendedauw
93fe721105 Fix for assertArrayEquals. Was throwing fatal for object elements
Change-Id: I8fa45237e028a814e0895ac0f2b3723394b50d6b
2012-08-12 22:55:55 +02:00
jeroendedauw
8caca131e4 Move method to its using test class rather then having a public static thing in the base test class
Change-Id: Id82225d0fb65dcd30b5724ee4f2d7838dfcb5ea6
2012-08-12 21:47:06 +02:00
jeroendedauw
10f8b5f340 Added utility method taking an array of elements and wrapping each element in it's own array.
Useful for data providers that only return a single argument.

Change-Id: I220948865e3de395363bf8858098e61de3c8d35b
2012-08-12 21:37:56 +02:00
jeroendedauw
974f4f8f37 Added missing @since tags and fixed style
Change-Id: I8941345be8f754bda40f4c36cf2082ca3d408c50
2012-08-12 21:35:37 +02:00
daniel
3db0b6684d fix logic bug in assertArrayEquals
Change-Id: I442ebfe77292918f29121aba1205de664723e468
2012-07-26 20:12:08 +02:00
jeroendedauw
06e54b828f Added assertArrayEquals method to MediaWikiTestCase to avoid duplicating asort and array_values all over the place
Change-Id: I8e8e7257b74268dff8c0d105a399257dfdc01b40
2012-07-02 16:24:10 +02:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Platonides
4c7dc368a6 The 4th Database::select() parameter is the function name.
The ORDER BY should be at $options.
This was throwing errors in PHP 5.4 due to the array being
converted to a string down at Database.php:862

Fixes 50ee1d2

Change-Id: Ifb0fc70144242f25fc916fb8d380ed3e2d334fb9
2012-06-01 00:13:36 +02:00
daniel
50ee1d23e5 Introducing LinksUpdateTest.
This test case is intended to test the updating of various links
tables using a LinksUpdate object, based on the information in
a ParserOutput object.

Patch set 3: Suggestions by Aaron:
             factored assertSelect() out into MediaWikiTestCase.
             Force sorting of result set under testing.

Change-Id: I2d01e67ee7396080a04e5dff637aca0dc159c65d
2012-05-13 17:07:10 +02:00
daniel
650e33efa4 Let tablesUsed imply needsDB in MediaWikiTestCase.
If the test says it uses database tables, then it needs the database.

And while we are at it, make the check for the test group declaration
more lenient.

Patch set 2: tweaked according to demon's comments.

Change-Id: Ib123745d45b85cebeab5ec87ea7d8227ec3d1dea
2012-05-07 14:56:33 -07:00
Christian Aistleitner
9e80e3a702 Adding temp file/dir management to MediaWikiTestCase
Change-Id: I4ac8f44f1d681925af231377e9d1b984488d3198
2012-04-10 17:08:00 +02:00
Aaron Schulz
c1c6433bfc * In NewParserTest, refactored code to use FileBackend (bug 31737). Also made some speed improvements and made regex= not flood the output with 600 items of crap.
* In FileBackendTest, call clean() on the dirs *after* deleting all the files first.
* Speed improvements to MediaWikiTestCase.
2012-01-25 23:11:53 +00:00
Alexandre Emsenhuber
46767b157e Use WikiPage instead of Article to call doEdit() 2011-12-16 18:55:20 +00:00
Aaron Schulz
e52f4fcb2a FU r105154: only clear tables that tests specify as written to. This reduces the obnoxious slowness that was getting in the way of FileBackend testing.
Since previously (pre-r105154) nothing was cleared, tests should still work.
2011-12-10 05:47:46 +00:00
Aaron Schulz
a66556d7eb * Made resetDB() actually clear out the tables rather than leave the contents
* Removed destroyDB(); unused and broken (does not use prefix)
2011-12-05 07:22:27 +00:00
Jure Kajzer
5933586266 some more oracle-phpunit-fu (should not affect non-oracle)
* CloneDatabase - already droping tables in internal function, removed duplicate action
* DatabaseOracle - stopped ignoring "temporary" parameter
* added two parameters to phpunit (use-normal-tables & reuse-db), default actions stay the same
* with reuse-db oracle phpunit test run on oracle down to 1m 20s ;)
2011-11-10 13:29:32 +00:00
Jure Kajzer
636f304d20 * phpunit fixes & optimizations for oracle backend 2011-11-09 15:50:24 +00:00
OverlordQ
8296d0736b Basic support for Postgres phpunit testing, currently throws 5 errors, 1 inc, 5 skipped 2011-10-24 19:28:31 +00:00
Aaron Schulz
a108dbfe8f Reverted r92489 and added/use hideDeprecated() to MW test framework 2011-07-25 16:27:33 +00:00
Platonides
4a6f236904 Readd r90538, this time with the missing global $wgHooks; 2011-06-22 21:02:07 +00:00
Chad Horohoe
65e2d85048 Provisional revert of r90538. I can't replicate the failures, but CI's been complaining since this commit 2011-06-22 00:01:15 +00:00
Platonides
1d7f09a4f7 UploadTest::testTitleValidation accessed the database to fetch the interwikis.
phase3/includes/upload/UploadBase.php:620
phase3/tests/phpunit/includes/UploadTest.php:120
phase3/tests/phpunit/includes/UploadTest.php:55
phase3/tests/phpunit/includes/UploadTest.php:35

$wgContLang not needed, TitlePermissionTest.php changes the language, inheriting from MediaWikiLangTestCase
2011-06-21 17:41:25 +00:00
Mark A. Hershberger
a6722cc9aa w/s changes. 2011-06-02 19:32:45 +00:00
Max Semenik
7ad10e271d Don't duplicate tables starting with unittest_ which can be left if a previous run ended with a fatal on SQLite 2011-06-02 17:58:34 +00:00
Chad Horohoe
a98cdb721d Mostly revert r89302, was slower than the original 2011-06-01 23:17:29 +00:00
Chad Horohoe
5004f09bfa Exclude Block tests until somebody fixes them, also cache listTables() result so we can skip some queries 2011-06-01 22:54:33 +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
6d221bdabe Allow test to remove data from the database
This new removeDBData() is run after the tests result. It is similar
to the addDBData() method.
2011-05-28 21:19:24 +00:00
Chad Horohoe
c84f722f13 Fixup phpunit tests so we don't drop/create tables on EVERY SINGLE TEST.
Now just create them on the first test that needsDB() and skip creation on the rest.
Leaves you with a bunch of useless tables at the end of a run, but oh well at least its faster :)
2011-05-24 21:22:36 +00:00
Platonides
f10c7a0b93 Cosmetic change 2011-05-01 19:31:18 +00:00
Platonides
f80b75a6aa The $wgLocalisationCacheConf was being overwritten by the default value.
Restores the ability to run databaseless tests broken by r86775
2011-04-29 16:26:20 +00:00
Platonides
54026190a1 r82867 converted $wgCaches into a class instance. Update the parsertests.
This faking is needed to avoid Table 'unittest_objectcache' doesn't exist errors when using temporary tables.
2011-03-06 23:15:10 +00:00
Max Semenik
b11cd099bb Don't dupe/drop parts of searchindex on SQLite 2011-03-05 16:09:10 +00:00
Max Semenik
332d709d8b MediaWikiTestCase: factored prefix generation to a separate function 2011-03-05 15:44:28 +00:00
Platonides
2e33fb3ff6 Finally commit the testing stuff I have been with this week. Could be considered a continuation of r79411.
Mixture of the NewParserTests.php with old code present in MediaWikiParserTest.php, reverting r79184 (revert of a revert...) and even eval().
Using the iterator as dataProvider, but defering the insertion of articles, as the dataprovider is processed on load, before switching dbs.
Each parser test appear now as a phpunit test. This means that by adding 683 tests (partly from extensions) we now surpass two thousand tests.
The downside of that is that they become painfully slow.
Initialise $wgHooks to $wgHooks, not to array() (r82499) as otherwise we lose ParserFirstCallInit registrations.
There's no attempt to support extensions registering to $wgParser instead of using ParserFirstCallInit properly (Cite falls in this category).
2011-02-26 21:49:42 +00:00
Platonides
4ef087080d maintenance/commandLine.inc loads DefaultSettings, LocalSettings and then runs Setup.php
As Setup.php assigns variables based on the cache config, bootstrap.php was late on reseting them, as some objects were already created.
So we could end up with a SqlBagOStuff created there, which when later accessed (such as trying to invalidate the cache for a user) would 
-as any non-sqlite SqlBagOStuff- open a new db connection. Which is precisely what we shall not be done when dealing with temporary tables
(and would indeed fail miserably due to not finding unittest_objectcache table).

In summary, reenabling temporary tables disabled in r79411.
2011-02-21 23:19:26 +00:00
Platonides
74b466ae9c Spaces to tabs 2011-02-20 17:52:09 +00:00
Platonides
ee25269cf3 Fix the completely broken r81880 2011-02-10 10:03:38 +00:00
Platonides
4a01e74356 Add support of assertEmpty (used since r81596) for phpunit < 3.5.0 2011-02-10 09:51:31 +00:00
Antoine Musso
ba4a69e0e2 Fix @dataProvider with PHPUnit 3.5.8+
MediaWikiTestCase duplicates code from PHPUnit constructor. It worked
fine until PHPUnit 3.5.8 made FrameWork_TestCase attributes private,
thus the children class is no more able to update them ($data for example)
The change break any tests making use of the @dataProvider helper.

PHPUnit commit:
0b85d08c39

TESTS:
3.5.7  : OK -> OK
3.5.8  : KO -> OK
3.5.10 : KO -> OK

make databaseless
Tests: 486, Assertions: 73986, Incomplete: 1, Skipped: 3.

(skipped tests are SQLite related)
2011-02-05 16:25:18 +00:00