When running unit tests, the bootstrap would previously load all extensions and skins in the filesystem. This was OK for an initial implementation, but is not acceptable if we want to eventually do that for all PHPUnit entry points (once we'll have a single config and bootstrap). Instead, it's desirable to only load the extensions specified in LocalSettings.php. The problem is that it's pretty much impossible to load LocalSettings.php without also loading the rest of MediaWiki, with all the side effects this might have. This patch introduces a helper script that loads all the config, then prints what extensions and skins were loaded. The bootstrap file runs this script via proc_open and then reads the list of extensions to load. Because the script is run in a separate process, any side effects only affect the spawned process, not the one where PHPUnit is running. Currently, there doesn't seem to be a better way to obtain the list of extensions loaded in LocalSettings.php without all the other side effects. YAML settings (https://www.mediawiki.org/wiki/Manual:YAML_settings_file_format) would probably help, but that's very far from becoming the only supported config format (if it will ever be). Also add two TestSuite implementations to replace the '*' wildcard in the extensions:unit and skins:unit suites. These use the same list of loaded extensions to determine where to look for tests. And last but not least: my most sincere apologies to you if the hack you're seeing here has ruined your day. If you think a better approach exists, please tell me and I'll be so relieved! Bug: T227900 Change-Id: Ib578644b8a4c0b64dca607afb9eb8204ca7fc660
106 lines
3.5 KiB
XML
106 lines
3.5 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="https://schema.phpunit.de/9.3/phpunit.xsd"
|
|
colors="true"
|
|
backupGlobals="false"
|
|
convertDeprecationsToExceptions="true"
|
|
convertErrorsToExceptions="true"
|
|
convertNoticesToExceptions="true"
|
|
convertWarningsToExceptions="true"
|
|
forceCoversAnnotation="true"
|
|
failOnWarning="true"
|
|
stopOnFailure="false"
|
|
failOnRisky="true"
|
|
beStrictAboutTestsThatDoNotTestAnything="true"
|
|
beStrictAboutOutputDuringTests="true"
|
|
verbose="false"
|
|
printerClass="MediaWikiPHPUnitResultPrinter"
|
|
stderr="true">
|
|
<!-- Output only to stderr to avoid "Headers already sent" problems -->
|
|
<php>
|
|
<ini name="memory_limit" value="-1" />
|
|
<ini name="max_execution_time" value="0" />
|
|
</php>
|
|
<testsuites>
|
|
<testsuite name="core:unit">
|
|
<directory>tests/phpunit/unit</directory>
|
|
</testsuite>
|
|
<testsuite name="extensions:unit">
|
|
<file>tests/phpunit/suites/ExtensionsUnitTestSuite.php</file>
|
|
</testsuite>
|
|
<testsuite name="skins:unit">
|
|
<file>tests/phpunit/suites/SkinsUnitTestSuite.php</file>
|
|
</testsuite>
|
|
<testsuite name="includes">
|
|
<directory>tests/phpunit/includes</directory>
|
|
</testsuite>
|
|
<testsuite name="parsertests">
|
|
<file>tests/phpunit/suites/CoreParserTestSuite.php</file>
|
|
<file>tests/phpunit/suites/ExtensionsParserTestSuite.php</file>
|
|
</testsuite>
|
|
<testsuite name="skins">
|
|
<directory>tests/phpunit/structure</directory>
|
|
<file>tests/phpunit/suites/ExtensionsTestSuite.php</file>
|
|
</testsuite>
|
|
<!-- As there is a class Maintenance, we cannot use the name "maintenance" directly -->
|
|
<testsuite name="maintenance_suite">
|
|
<directory>tests/phpunit/maintenance</directory>
|
|
</testsuite>
|
|
<testsuite name="structure">
|
|
<directory>tests/phpunit/structure</directory>
|
|
</testsuite>
|
|
<testsuite name="tests">
|
|
<directory>tests/phpunit/tests</directory>
|
|
</testsuite>
|
|
<testsuite name="extensions">
|
|
<directory>tests/phpunit/structure</directory>
|
|
<file>tests/phpunit/suites/ExtensionsTestSuite.php</file>
|
|
<file>tests/phpunit/suites/ExtensionsParserTestSuite.php</file>
|
|
</testsuite>
|
|
<testsuite name="integration">
|
|
<directory>tests/phpunit/integration</directory>
|
|
</testsuite>
|
|
<testsuite name="docs">
|
|
<directory>tests/phpunit/docs</directory>
|
|
</testsuite>
|
|
</testsuites>
|
|
<groups>
|
|
<exclude>
|
|
<group>Broken</group>
|
|
</exclude>
|
|
</groups>
|
|
<coverage includeUncoveredFiles="false">
|
|
<include>
|
|
<directory suffix=".php">includes</directory>
|
|
<directory suffix=".php">languages</directory>
|
|
<directory suffix=".php">maintenance</directory>
|
|
<directory suffix=".php">extensions</directory>
|
|
<directory suffix=".php">skins</directory>
|
|
</include>
|
|
<exclude>
|
|
<directory suffix=".php">languages/messages</directory>
|
|
<directory suffix=".php">maintenance/benchmarks</directory>
|
|
<directory suffix=".php">extensions/*/tests</directory>
|
|
<directory suffix=".php">skins/*/tests</directory>
|
|
</exclude>
|
|
</coverage>
|
|
<listeners>
|
|
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener">
|
|
<arguments>
|
|
<array>
|
|
<element key="slowThreshold">
|
|
<integer>100</integer>
|
|
</element>
|
|
<element key="reportLength">
|
|
<integer>10</integer>
|
|
</element>
|
|
</array>
|
|
</arguments>
|
|
</listener>
|
|
</listeners>
|
|
<extensions>
|
|
<extension class="MediaWikiLoggerPHPUnitExtension" />
|
|
<extension class="MediaWikiTeardownPHPUnitExtension" />
|
|
</extensions>
|
|
</phpunit>
|