wiki.techinc.nl/tests/phpunit/bootstrap.common.php
Daimona Eaytoy 43015d5d87 phpunit: Simplify PHPUnit bootstrap files
- Consolidate the common parts into a shared bootstrap.common.php file
- Rearrange the code a bit to clarify when certain things (like globals)
  are actually needed.
- Replace the bootstrap class with two global functions, and inline two
  other functions.

This change should be a no-op for both unit and integration tests.

Change-Id: Ie20617ac80d12f99ceaeae53b852cc6ed76b3feb
2023-07-12 20:27:42 +00:00

22 lines
795 B
PHP

<?php
if ( ( PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg' ) || defined( 'MEDIAWIKI' ) ) {
exit( 'This file is only meant to be executed indirectly by PHPUnit\'s bootstrap process' );
}
define( 'MEDIAWIKI', true );
define( 'MW_ENTRY_POINT', 'cli' );
// Set a flag which can be used to detect when other scripts have been entered
// through this entry point or not.
define( 'MW_PHPUNIT_TEST', true );
require_once __DIR__ . '/../common/TestSetup.php';
require_once __DIR__ . "/../../includes/BootstrapHelperFunctions.php";
// phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.allowedPrefix
global $IP;
$IP = wfDetectInstallPath();
// Note: unit tests don't use a settings file but some code still assumes that one exists
wfDetectLocalSettingsFile( $IP );
TestSetup::snapshotGlobals();