Following discussion in Ibb8175981092d7f41864e641cc3c118af70a5c76, this patch proposes to further reduce the scope of what unit tests may access, by removing the loading of DefaultSettings and GlobalFunctions.php. This also has the implied effect of disabling the storage backend, as well as the global service locator. MediaWikiTestCase is renamed to MediaWikiIntegrationTestCase so it's scope and purpose is more clear. Whether we still need to keep `@group Database` annotation around is debatable, as it's unclear to me what the performance costs are of implying database access for all tests which extend IntegrationTestCase. As far as I can tell, `@group Database` is primarily used in CI to run faster tests before slower ones, and with the new UnitTestCase the annotation seems redundant. To run all testsuites, use `composer phpunit`. Other composer scripts: - `composer phpunit:unit` to run unit tests - `composer phpunit:integration` to run integration tests - `composer phpunit:coverage` to generate code coverage reports from unit tests (requires XDebug). Note that you can pass arguments to composer scripts with `--`, e.g. `composer phpunit:integration --exclude-group Dump`. Other changes: - Rename bootstrap.php to bootstrap.maintenance.php so it's clear it's part of the legacy PHPUnit-as-maintenance-class setup - Create new bootstrap.php which loads the minimal configuration necessary for the tests, and do additional setup in the run() method of the unit/integration test case classes - Move the unit-tests.xml file to phpunit.xml.dist in preparation for this being the default test configuration For a follow-up patch: - Find unit/integration tests for extensions/skins - Migrate other test suites from suite.xml - Support running all tests via vendor/bin/phpunit Bug: T84948 Bug: T89432 Bug: T87781 Change-Id: Ie717b0ecf4fcfd089d46248f14853c80b7ef4a76
62 lines
1.7 KiB
XML
62 lines
1.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<phpunit bootstrap="tests/phpunit/bootstrap.php"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
|
|
|
|
colors="true"
|
|
backupGlobals="false"
|
|
convertErrorsToExceptions="true"
|
|
convertNoticesToExceptions="true"
|
|
convertWarningsToExceptions="true"
|
|
forceCoversAnnotation="true"
|
|
stopOnFailure="false"
|
|
timeoutForSmallTests="10"
|
|
timeoutForMediumTests="30"
|
|
timeoutForLargeTests="60"
|
|
beStrictAboutTestsThatDoNotTestAnything="true"
|
|
beStrictAboutOutputDuringTests="true"
|
|
beStrictAboutTestSize="true"
|
|
verbose="false">
|
|
<php>
|
|
<ini name="memory_limit" value="512M" />
|
|
</php>
|
|
<testsuites>
|
|
<testsuite name="unit">
|
|
<directory>tests/phpunit/unit</directory>
|
|
</testsuite>
|
|
<testsuite name="integration">
|
|
<directory>tests/phpunit/integration</directory>
|
|
</testsuite>
|
|
</testsuites>
|
|
<groups>
|
|
<exclude>
|
|
<group>Broken</group>
|
|
</exclude>
|
|
</groups>
|
|
<filter>
|
|
<whitelist addUncoveredFilesFromWhitelist="true">
|
|
<directory suffix=".php">includes</directory>
|
|
<directory suffix=".php">languages</directory>
|
|
<directory suffix=".php">maintenance</directory>
|
|
<exclude>
|
|
<directory suffix=".php">languages/messages</directory>
|
|
<file>languages/data/normalize-ar.php</file>
|
|
<file>languages/data/normalize-ml.php</file>
|
|
</exclude>
|
|
</whitelist>
|
|
</filter>
|
|
<listeners>
|
|
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener">
|
|
<arguments>
|
|
<array>
|
|
<element key="slowThreshold">
|
|
<integer>50</integer>
|
|
</element>
|
|
<element key="reportLength">
|
|
<integer>50</integer>
|
|
</element>
|
|
</array>
|
|
</arguments>
|
|
</listener>
|
|
</listeners>
|
|
</phpunit>
|