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
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
"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
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
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
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
Also update some previous inconsistencies pointed out by Krinkle in change IDs:
* Ide20743a2e84ff68549286120e6cff9d9f396f54
* I811ca957b6588085d67606ebc0cd4033a1e53839
Change-Id: Ife33b931870d0d7e04fcb40974997436d27f528f
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
· 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
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
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
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
* 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
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.
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.