aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/phpunit.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/phpunit.php')
-rwxr-xr-xtests/phpunit/phpunit.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php
new file mode 100755
index 000000000000..94d4ebd2d603
--- /dev/null
+++ b/tests/phpunit/phpunit.php
@@ -0,0 +1,31 @@
+#!/usr/bin/env php
+<?php
+/**
+ * Bootstrapping for MediaWiki PHPUnit tests
+ *
+ * @file
+ */
+
+/* Configuration */
+
+// Evaluate the include path relative to this file
+$IP = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
+
+// 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 );
+
+// Start up MediaWiki in command-line mode
+require_once( "$IP/maintenance/commandLine.inc" );
+
+// Assume UTC for testing purposes
+$wgLocaltimezone = 'UTC';
+
+require_once( 'PHPUnit/Runner/Version.php' );
+if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) {
+ # PHPUnit 3.5.0 introduced a nice autoloader based on class name
+ require_once( 'PHPUnit/Autoload.php' );
+} else {
+ # Keep the old pre PHPUnit 3.5.0 behaviour for compatibility
+ require_once( 'PHPUnit/TextUI/Command.php' );
+}
+PHPUnit_TextUI_Command::main();