Commit graph

45 commits

Author SHA1 Message Date
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
Alexandre Emsenhuber
de4a9c6b9a Reset the cache used in User::idFromName(), otherwise tests will try to add the user '127.0.0.1' multiple times, resulting in a database error (duplicate key for user_name field) 2011-01-25 16:32:43 +00:00
Jure Kajzer
f853d711ac * fixed Oracle code for installer and phpunit tests
* removed ORABlob class
2011-01-10 19:22:27 +00:00
Chad Horohoe
d71167fa60 Move table prefixes to constants, add doc to addDBData() 2011-01-10 18:34:59 +00:00
Platonides
1cb56fc8e3 Remove unused globals 2011-01-01 22:16:58 +00:00
X!
f8d74604fd More work on new parser tests:
-No need to specify a new function for each argument, use PHP5 magic to automatically set it
-Create (g|s)etCliArg() functions
-Implement some features from the old parser tests
2011-01-01 05:53:04 +00:00
X!
34fc833407 Start work on porting ParserTests completely into PHPunit.
Disable temporary tables, a few reports of them not working. The tables get deleted anyway, so why risk it?
2011-01-01 03:39:37 +00:00
X!
2441c2d5e4 For some reason tableExists() is being unreliable, which is resulting in tables not being dropped that _should_ be dropped. Drop them anyway and ignore the errors. 2010-12-31 21:51:21 +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
X!
02077c9901 Add check to make sure only MySQL and SQLite are used at the moment. These two are the only ones with the listTables() function, and the only ones that are tested. 2010-12-31 21:10:36 +00:00
X!
90e371195e Only destroy DB if it needs it 2010-12-31 21:05:51 +00:00
X!
1b7bfdee49 I made MySQL work, and broke SQLite in the process. I fix SQLite, and made MySQL break. Fixing MySQL again, hoping that SQLite works too. :) 2010-12-31 21:01:17 +00:00
X!
025defad3f Solved problem with SQLite: Globals were getting stored, and when a PDO reference is transferred, as is the case with SQLite, it serializes the globals. 2010-12-31 20:47:48 +00:00
X!
dd68f3947a More work on getting SQLite to work with unit tests. DB Prefix changing is now static to allow for external classes to change it. 2010-12-31 20:42:39 +00:00
X!
1993c83277 -Destroy the DB automatically when initting the DB
-Add $force option to wfSetVar
-More work on getting SQLite to work
2010-12-30 17:30:35 +00:00
Platonides
c97d18b7ea Follow up r79109. Do not use create_function. 2010-12-30 16:24:29 +00:00
Platonides
4cb81e08f4 Move MediaWikiTestCase class to a new file and load it from phpunit.php
This restores the ability to run single tests with 
php phpunit.php includes/filename.php
2010-12-29 15:52:07 +00:00