Commit graph

83 commits

Author SHA1 Message Date
csteipp
90b3d62854 Prevent GC during phpunit shutdown
To keep phpunit from segfaulting during shutdown, turn off GC for
php 5.3.

Bug: 62623
Change-Id: Ie59780e37cbea027cc204a43df406667c3f432ab
2014-04-14 21:09:10 +00:00
addshore
3b3806d27a Remove assignment in conditon in phpunit.php
Change-Id: I817af3cf5344d9ffe2a66048f6d32835712ba11c
2014-03-14 19:13:06 +01:00
Adrian Lang
46db65ed07 Update PHPUnit version check to 3.7.0
assertContainsOnlyInstancesOf has been added in PHPUnit 3.7.0, so we need to
have that version for running the tests.

Bug: 59759
Change-Id: I25dbd377b97ec0b9062d3c8cf495ba3f06956ac4
2014-01-07 09:46:46 +00:00
Siebrand Mazeland
e711503e7a Remove underscore from classes LCStore_*
iPart of program to remove underscores from class names. Checked core and
600+ extensions for occurrences. All uses are in core, and are updated in
this change.

Change-Id: I432dc249d22053728013ae7d0d56c3c398021c5e
2013-11-17 22:09:31 +01:00
umherirrender
24bfde2710 Fix spacing and break some lines
Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac
2013-08-24 17:06:25 +02:00
Daniel Friesen
2740518620 Support installing PHPUnit using composer.
"phpunit/phpunit" already exists inside our composer.json's "require-dev" however this has been
entirely useless as we don't include the autoloader which would load composer's PHPUnit.

This change begins including composer's autoloader when present and also tweaks phpunit.php
to ensure PHPUnit isn't double loaded. As a result besides supporting PHPUnit via composer this
also means that we're ready to make use of any library we add to our composer.json in the future.

Change-Id: I891740e8fd3d237c5f473862027205d951f564b9
2013-06-07 02:07:27 -07:00
Antoine Musso
7a82d5b779 test: inject autoloader in Maintenance class
We used to inject the test autoloader from the global space after the
Maintenance class has been initialized.  That prevents us from using
tests classes (such as Mock) during the Maintenance setup.

This patch move the TestsAutoLoader.php require() at the beginning of
finalSetup() which would let use Mock classes.

Change-Id: Ia402eafae8407d1516e3d200ac97539e3681fdc6
2013-06-01 09:27:11 +02:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00
Timo Tijhof
50e7985d4d phpcs: Fix WhiteSpace.LanguageConstructSpacing warnings
Squiz.WhiteSpace.LanguageConstructSpacing:
   Language constructs must be followed by a single space;
   expected "require_once expression" but found
   "require_once(expression)"

It is a keyword (e.g. like `new`, `return` and `print`). As
such the parentheses don't make sense.

Per our code conventions, we use a space after keywords like
these. We appeared to have an unwritten exception for `require`
that doesn't make sense. About 60% of require/include usage
was missing the space and/or had superfluous parentheses.

It is as silly as print("foo") or return("foo"), it works
because keywords have no significance for whitespace between
it and the expression that follows, and since experessions can
be wrapped in parentheses for clarity (e.g. when doing string
concatenation or mathematical operations) the parenthesis
before and after basiclaly just ignored.

Change-Id: I2df2f80b8123714bea7e0771bf94b51ad5bb4b87
2013-05-09 05:56:26 +02:00
Siebrand Mazeland
791d0b2a98 Update code formatting
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
2013-04-26 14:21:20 +00:00
Siebrand Mazeland
6da93fc6f6 Update code formatting
Also update some previous inconsistencies pointed out by Krinkle in change IDs:
* Ide20743a2e84ff68549286120e6cff9d9f396f54
* I811ca957b6588085d67606ebc0cd4033a1e53839

Change-Id: Ife33b931870d0d7e04fcb40974997436d27f528f
2013-03-27 14:15:11 +01:00
Platonides
9cd81e4c14 (Bug 44192) Do not attempt to send a real e-mail
The ApiAccountCreationTest is attempting to send an email to the newly
created user. The tests should really never send any email. This patch
register a noop callback for the 'AlternateUserMailer' hook which would
disable email entirely in our test suite.

This is generic version of 2025a89 which was only disabling mail for the
ApiAccountCreationTest test and that Antoine reverted.

Change-Id: I7b3ba4f7563a5818c988d6f8da165cc3c984f160
2013-02-28 14:17:08 -08:00
Platonides
d01be611d0 Script calling cleanups
· Use env(1) in shebangs instead of hardcoding paths.
· $IP is already set in the constructor of Maintenance classes.
· Add sapi guard to some phpunit files.

Change-Id: I6c6fd6c61e2861b5992f2ccd67a4e3f62e2c445e
2013-02-25 23:11:51 +01:00
Siebrand Mazeland
454d92fb7c Update formatting
8 of n.

Change-Id: I55551510e7afde5b6b981697d5c0efd7b9507585
2013-02-15 13:08:55 +00:00
jeroendedauw
38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00
daniel
4b291909e0 wfWarn() should cause phpunit tests to fail.
This forces $wgDevelopmentWarnings to true for phpunit tests.

Note that wfWarn uses the E_USER_NOTICE level per default, which may or may not
actually cause test cases to fail, depending on the phpunit configuration.

Change-Id: I36583fb063436cc8474873b468fc983d28377cbd
2012-08-27 14:28:47 +02:00
Christian Aistleitner
096592cf14 Bumping minimum supported version of PHPUnit to 3.6.7
With PHPUnit 3.6.7, we can finally check the output of tests.

Change-Id: Ib0f1afe5fd9ab9784ba7f78b2921cf047ccc83f3
2012-04-29 10:02:23 +02:00
Antoine Musso
3b9a3678b3 let us easily override PHPUnit version
The new --with-phpunitdir let us specify a git checkout of PHPUnit. That
will ease regression testing of the upstream new version. Usage is
straightforward:

Checkout PHPUnit from git as instructed on:
https://github.com/sebastianbergmann/phpunit#readme

Invoke our test suite with:
 $ cd maintenance/tests
 $ php phpunit.php --with-phpunitdir /path/you/just/checked/out

Change-Id: I8a9af0deac4dd74e3c8bde73535555c54ac83766
2012-04-17 15:39:15 +02:00
Aaron Schulz
10f49bd065 [LanguageConverter] Added some cache code based on the problems in r97512.
* Added $wgLanguageConverterCacheType global to control LC cache type. We can use it to enable direct apc use for language converter (to match the live hack).
* Added $wgLangConvMemc object, available via Setup.php

Change 1:
* Updated unit tests
* Minor documentation cleanup in DefaultSettings.php

Change-Id: Icd5dd28407e9759ce294c784ec41d9ca15c89616
2012-04-06 13:26:17 -07:00
Tim Starling
2462a1ae71 Make arguments to phpunit.php work. It's hard to believe this could have been broken since r79164, so maybe it was a change in the command line parser that PHPUnit uses that made it treat any options after the first non-option argument as being plain arguments rather than actual options. 2012-01-23 19:06:09 +00:00
Max Semenik
6016958c3c To prevent creepy errors like bug 28908, raised PHPUnit requirement to 3.5 2011-05-10 19:45:47 +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
Sam Reed
8e80b8c3c1 Tidy up some unused variables and such 2011-04-23 21:40:52 +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
71ee20cd18 Move $wgLocalisationCacheConf disabling from bootstrap.php to phpunit.php 2011-01-21 22:44:40 +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
Platonides
439b5a4f65 Follow up r79183 removing global added in r79154 2010-12-29 16:45:16 +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
X!
fa0ce7197a -Set configuration automatically if not set. This allows for evasion of the makefile, ergo, more control.
-Remove instances of @covers; they were breaking code-coverage
2010-12-29 05:38:11 +00:00
X!
edbf743aeb Make MediaWikiParserTest work now in PHPUnit. There are still a few bugs, such as stopping tests if one fails,
lack of fuzz testing and other parser test options, and the DB creation is still a little flaky.
A MediaWikiPHPUnitCommand class had to be created to allow for custom CLI parameters.
2010-12-29 02:23:51 +00:00
Happy-melon
8e57be2831 Follow-up r77762 per CR, and an unrelated one-character whitespace fix which doesn't deserve its own revision id... :D 2010-12-16 18:30:15 +00:00
Mark A. Hershberger
640f12cd5e Repair phpunit.php 2010-12-16 01:32:28 +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