Daniel Werner has submitted this change and it was merged. Change subject: Added evilMediaWikiBootstrap.php so the WikibaseDatabase test runner can also run the MW dependent tests ......................................................................
Added evilMediaWikiBootstrap.php so the WikibaseDatabase test runner can also run the MW dependent tests Change-Id: I6ea07de3d42ba75ccd9a36f865b230f4e0d3efbb --- M Database/tests/bootstrap.php A Database/tests/evilMediaWikiBootstrap.php 2 files changed, 78 insertions(+), 0 deletions(-) Approvals: Daniel Werner: Looks good to me, approved jenkins-bot: Verified diff --git a/Database/tests/bootstrap.php b/Database/tests/bootstrap.php index 185a4e6..b110eb4 100644 --- a/Database/tests/bootstrap.php +++ b/Database/tests/bootstrap.php @@ -12,6 +12,10 @@ * @author Jeroen De Dauw < [email protected] > */ +if ( !in_array( '--testsuite=WikibaseDatabaseStandalone', $GLOBALS['argv'] ) ) { + require_once( __DIR__ . '/evilMediaWikiBootstrap.php' ); +} + require_once( __DIR__ . '/../Database.php' ); require_once( __DIR__ . '/testLoader.php' ); diff --git a/Database/tests/evilMediaWikiBootstrap.php b/Database/tests/evilMediaWikiBootstrap.php new file mode 100644 index 0000000..6e63395 --- /dev/null +++ b/Database/tests/evilMediaWikiBootstrap.php @@ -0,0 +1,74 @@ +<?php + +define( 'MEDIAWIKI', true ); + +global $IP; +$IP = getenv( 'MW_INSTALL_PATH' ); + +if ( $IP === false ) { + $IP = dirname( __FILE__ ) . '/../../../..'; +} + +$self = 'foobar'; + +// Detect compiled mode +# Get the MWInit class +require_once "$IP/includes/Init.php"; +require_once "$IP/includes/AutoLoader.php"; +# Stub the profiler +require_once "$IP/includes/profiler/Profiler.php"; + +# Start the profiler +$wgProfiler = array(); +if ( file_exists( "$IP/StartProfiler.php" ) ) { + require "$IP/StartProfiler.php"; +} + +// Some other requires +require_once "$IP/includes/Defines.php"; + +require_once MWInit::compiledPath( 'includes/DefaultSettings.php' ); + +foreach ( get_defined_vars() as $key => $var ) { + if ( !array_key_exists( $key, $GLOBALS ) ) { + $GLOBALS[$key] = $var; + } +} + +if ( defined( 'MW_CONFIG_CALLBACK' ) ) { + # Use a callback function to configure MediaWiki + MWFunction::call( MW_CONFIG_CALLBACK ); +} else { + if ( file_exists( "$IP/../wmf-config/wikimedia-mode" ) ) { + // Load settings, using wikimedia-mode if needed + // @todo FIXME: Replace this hack with general farm-friendly code + # @todo FIXME: Wikimedia-specific stuff needs to go away to an ext + # Maybe a hook? + global $cluster; + $cluster = 'pmtpa'; + require MWInit::interpretedPath( '../wmf-config/wgConf.php' ); + } + // Require the configuration (probably LocalSettings.php) + require loadSettings(); +} + +// Some last includes +require_once MWInit::compiledPath( 'includes/Setup.php' ); + +// Much much faster startup than creating a title object +$wgTitle = null; + + +function loadSettings() { + global $wgCommandLineMode, $IP; + + $settingsFile = "$IP/LocalSettings.php"; + + if ( !is_readable( $settingsFile ) ) { + $this->error( "A copy of your installation's LocalSettings.php\n" . + "must exist and be readable in the source directory.\n" . + "Use --conf to specify it.", true ); + } + $wgCommandLineMode = true; + return $settingsFile; +} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/64943 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6ea07de3d42ba75ccd9a36f865b230f4e0d3efbb Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw <[email protected]> Gerrit-Reviewer: Anja Jentzsch <[email protected]> Gerrit-Reviewer: Ataherivand <[email protected]> Gerrit-Reviewer: Aude <[email protected]> Gerrit-Reviewer: Daniel Kinzler <[email protected]> Gerrit-Reviewer: Daniel Werner <[email protected]> Gerrit-Reviewer: Demon <[email protected]> Gerrit-Reviewer: Denny Vrandecic <[email protected]> Gerrit-Reviewer: Henning Snater <[email protected]> Gerrit-Reviewer: Jens Ohlig <[email protected]> Gerrit-Reviewer: Jeroen De Dauw <[email protected]> Gerrit-Reviewer: John Erling Blad <[email protected]> Gerrit-Reviewer: Lydia Pintscher <[email protected]> Gerrit-Reviewer: Markus Kroetzsch <[email protected]> Gerrit-Reviewer: Nikola Smolenski <[email protected]> Gerrit-Reviewer: Silke Meyer <[email protected]> Gerrit-Reviewer: Tobias Gritschacher <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
