Jeroen De Dauw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/67441
Change subject: DO NOT MERGE
......................................................................
DO NOT MERGE
Change-Id: I7e88ba581c78bcc5deeb19e3e02d860728b7806c
---
M QueryEngine/phpunit.xml.dist
M QueryEngine/tests/bootstrap.php
A QueryEngine/tests/evilMediaWikiBootstrap.php
3 files changed, 72 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/41/67441/1
diff --git a/QueryEngine/phpunit.xml.dist b/QueryEngine/phpunit.xml.dist
index 38769f8..96f606a 100644
--- a/QueryEngine/phpunit.xml.dist
+++ b/QueryEngine/phpunit.xml.dist
@@ -17,5 +17,8 @@
<directory>tests/phpunit</directory>
<exclude>tests/integration</exclude>
</testsuite>
+ <testsuite name="QueryEngineIntegration">
+ <directory>tests/integration</directory>
+ </testsuite>
</testsuites>
</phpunit>
diff --git a/QueryEngine/tests/bootstrap.php b/QueryEngine/tests/bootstrap.php
index 5cae02a..54d95a3 100644
--- a/QueryEngine/tests/bootstrap.php
+++ b/QueryEngine/tests/bootstrap.php
@@ -12,6 +12,10 @@
* @author Jeroen De Dauw < [email protected] >
*/
+if ( !in_array( '--testsuite=QueryEngineIntegration', $GLOBALS['argv'] ) ) {
+ require_once( __DIR__ . '/evilMediaWikiBootstrap.php' );
+}
+
require_once( __DIR__ . '/../../../DataValues/DataValues/DataValues.php' );
require_once( __DIR__ . '/../../../Ask/Ask.php' );
diff --git a/QueryEngine/tests/evilMediaWikiBootstrap.php
b/QueryEngine/tests/evilMediaWikiBootstrap.php
new file mode 100644
index 0000000..e262ecd
--- /dev/null
+++ b/QueryEngine/tests/evilMediaWikiBootstrap.php
@@ -0,0 +1,65 @@
+<?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 {
+ // 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/67441
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e88ba581c78bcc5deeb19e3e02d860728b7806c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits