Debian Codegraph @

tests/phpunit/bootstrap.maintenance.php

raw symbols SCIP
1 <?php
2 /**
3 * DEPRECATED: This file only exists for BC with tests/phpunit/phpunit.php and will be removed together with it.
4 *
5 * @file
6 */
7
8 if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
9 echo <<<EOF
10 You are running these tests directly from phpunit. You may not have all globals correctly set.
11 Running `composer phpunit` instead is recommended.
12 EOF;
13 require_once __DIR__ . "/phpunit.php";
14 }
15
16 // The TestRunner class will run each test suite and may call
17 // exit() with an exit status code. As such, we cannot run code "after the last test"
18 // by adding statements to PHPUnitMaintClass::execute.
19 // Instead, we work around it by registering a shutdown callback from the bootstrap
20 // file, which runs before PHPUnit starts.
21 // @todo Once we use PHPUnit 8 or higher, use the 'AfterLastTestHook' feature.
22 // https://phpunit.readthedocs.io/en/8.0/extending-phpunit.html#available-hook-interfaces
23 register_shutdown_function( static function () {
24 // This will:
25 // - clear the temporary job queue.
26 // - allow extensions to delete any temporary tables they created.
27 // - restore ability to connect to the real database.
28 MediaWikiIntegrationTestCase::teardownTestDB();
29 } );