wiki.techinc.nl/tests/phpunit/MediaWikiDeprecatedConfigPHPUnitExtension.php
Daimona Eaytoy a69c57b852 phpunit: Deprecate suite.xml and composer phpunit:entrypoint
Leave `composer phpunit` as the main PHPUnit entry point, a single
config file (phpunit.xml.dist) and a single bootstrap (bootstrap.php).
Deprecate the `composer phpunit:entrypoint`, making it print a
deprecation message and then fall back to `composer phpunit`. Deprecate
boostrap.integration.php as well. Update the release notes accordingly.

Add a temporary PHPUnit extension, only enabled in suite.xml, that
prints a deprecation message. Define a new constant in phpunit.php to
avoid printing 2 deprecation messages when phpunit.php is used (as it
auto-defaults to suite.xml).

Add some documentation to bootstrap.php.

Bug: T227900
Depends-On: Ie91c9f2882f12fd8ea822529528dd1dd9efe89db
Change-Id: If2ffe0522422fd6aadcc08988789d98c2403fc48
2023-12-21 08:22:35 +00:00

24 lines
762 B
PHP

<?php
use PHPUnit\Runner\BeforeFirstTestHook;
/**
* PHPUnit extension temporarily used to emit a deprecation notice when suite.xml is used
*/
class MediaWikiDeprecatedConfigPHPUnitExtension implements BeforeFirstTestHook {
public function executeBeforeFirstTest(): void {
if ( defined( 'PHPUNIT_LEGACY_ENTRYPOINT' ) ) {
// A deprecation notice was already emitted by phpunit.php, no need to add another one.
return;
}
$msg = <<<EOT
*******************************************************************************
DEPRECATED: The tests/phpunit/suite.xml config file has been deprecated. Use
phpunit.xml.dist instead.
*******************************************************************************
EOT;
fwrite( STDERR, $msg );
}
}