phpunit.php did that, and also the bootstrap file before
Ie20617ac80d12f99ceaeae53b852cc6ed76b3feb. I was under the impression
that wfDetectInstallPath would also set this variable, but it doesn't --
it only sets $IP and the MW_INSTALL_PATH constant.
So restore the bit of code that sets the env variable, but do that only
in the bootstrap, and not in wfDetectInstallPath, because it's
presumably not needed there.
Change-Id: Icbd718bdea3567fb85d39926bed93af72de60c9b
- Move handling of PHPUNIT_WIKI to the common bootstrap, the values
might be needed in integration tests.
- Add method to TestSetup for checking composer.lock, and use it in both
bootstraps. This cannot be moved to the common bootstrap yet, because
it needs to run after loading MW.
- In MediaWikiIntegrationTestCase::
initializeForStandardPhpunitEntrypointIfNeeded, use global $IP instead
of redefining it.
Bug: T227900
Change-Id: I050dcc36b814abd7b909eaaf6d356ecd0d3a0c80
- Remove display_errors override. This was copied from the Maintenance
class in Id6d7e9db, but it's unnecessary here because we configure
PHPUnit to fail if a PHP notice/warning is emitted. This causes the
warning/notice to be converted to a failed assertion handled by
PHPUnit.
- Remove code that turned off output buffering, also copied from
Maintenance. I'd say it's unlikely for output buffering to enabled at
that point, and most importantly, we would enable output buffering a
bit later anyway.
- Call ob_start earlier, so that it also works for anything that prints
messages even before dataProviders are run (e.g., setup or
bootstrap code).
- Move the ob_start call to the common bootstrap, as unit tests are
still affected by the same issue that the call aimed to fix.
- Print the PHP version immediately, and do that for unit tests too.
- Get rid of MediaWikiCliOptions in favour of private code in
MediaWikiIntegrationTestCase, which is the only class supposed to
access those settings.
- Set wgCommandLineMode in the common bootstrap. Assume that nobody is
changing its value randomly in config files because that'd be
ill-advised.
- Inline code for setting memory_limit and max_execution_time, and run
it only after loading the settings. Doing that earlier is pointless,
because these values are already set in suite.xml.
- Update obsolete comment mentioning PHPUnitMaintClass, which is long
gone. In the current code, this is the only way (besides PHPUnit
hooks/events) to run code before PHP exits. Also remove the second
part because we're now on PHPUnit 9, so this should be actionable now.
Remove link to the PHPUnit documentation as it no longer works. There
doesn't seem to be an equivalent link for PHPUnit 9, perhaps because
hooks were replaced with events. There //is// an equivalent link in
the PHPUnit 10 documentation (for events), but we're not yet using it.
Change-Id: I79bbbfcfe4eab3ff5ae81b2deb6450ba06ad7611
- Consolidate the common parts into a shared bootstrap.common.php file
- Rearrange the code a bit to clarify when certain things (like globals)
are actually needed.
- Replace the bootstrap class with two global functions, and inline two
other functions.
This change should be a no-op for both unit and integration tests.
Change-Id: Ie20617ac80d12f99ceaeae53b852cc6ed76b3feb