#!/usr/bin/env php run( $args, true ); } } if ( PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg' ) { exit( 'This script must be run from the command line' ); } if ( strval( getenv( 'MW_INSTALL_PATH' ) ) === '' ) { putenv( 'MW_INSTALL_PATH=' . realpath( __DIR__ . '/../..' ) ); } if ( getenv( 'PHPUNIT_WIKI' ) ) { $wikiName = getenv( 'PHPUNIT_WIKI' ); $bits = explode( '-', $wikiName, 2 ); define( 'MW_DB', $bits[0] ); define( 'MW_PREFIX', $bits[1] ?? '' ); define( 'MW_WIKI_NAME', $wikiName ); } // Define the MediaWiki entrypoint $IP = getenv( 'MW_INSTALL_PATH' ); global $wgIntegrationBootstrapWrapper; $wgIntegrationBootstrapWrapper = new PHPUnitMaintClass(); $wgIntegrationBootstrapWrapper->setup(); require_once "$IP/includes/BootstrapHelperFunctions.php"; // ensure MW_INSTALL_PATH is defined $IP = wfDetectInstallPath(); wfDetectLocalSettingsFile( $IP ); require_once "$IP/includes/Setup.php"; // Deregister handler from MWExceptionHandler::installHandle so that PHPUnit's own handler // stays in tact. Needs to happen after including Setup.php, which calls MWExceptionHandler::installHandle(). restore_error_handler(); $wgIntegrationBootstrapWrapper->execute();