aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/bootstrap.maintenance.php
blob: d0ac1934d0f5dbc1e2da03f685086c2f25c84a85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/**
 * DEPRECATED: This file only exists for BC with tests/phpunit/phpunit.php and will be removed together with it.
 *
 * @file
 */

if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
	echo <<<EOF
You are running these tests directly from phpunit. You may not have all globals correctly set.
Running `composer phpunit` instead is recommended.
EOF;
	require_once __DIR__ . "/phpunit.php";
}

// The TestRunner class will run each test suite and may call
// exit() with an exit status code. As such, we cannot run code "after the last test"
// by adding statements to PHPUnitMaintClass::execute.
// Instead, we work around it by registering a shutdown callback from the bootstrap
// file, which runs before PHPUnit starts.
// T253699: Not switching to PHPUnit's 'AfterLastTestHook' as this entrypoint is
// deprecated.
register_shutdown_function( static function () {
	// This will:
	// - clear the temporary job queue.
	// - allow extensions to delete any temporary tables they created.
	// - restore ability to connect to the real database.
	MediaWikiIntegrationTestCase::teardownTestDB();
} );