* use require_once for ProfilerStub.php, GlobalFunctions.php and Hooks.php, these...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 15 Jan 2010 16:55:00 +0000 (16:55 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 15 Jan 2010 16:55:00 +0000 (16:55 +0000)
* always use the complete path (with $IP) when loading files with require(_once)
* include AutoLoader before LocalSettings.php as we do in WebStart.php
* don't load DefaultSettings.php, it's already done by LocalSettings.php
* define MW_PHPUNIT_TEST constant
* added a description for the file

tests/bootstrap.php

index dfdf3d3..1023f06 100644 (file)
@@ -1,16 +1,24 @@
 <?php
 
+/**
+ * Set up the MediaWiki environment when running tests with "phpunit" command
+ *
+ * Warning: this file is not included from global scope!
+ * @file
+ */
+
 global $wgCommandLineMode, $IP;
 $wgCommandLineMode = true;
 $IP = dirname( dirname( __FILE__ ) );
-define('MEDIAWIKI', 1);
+
+define( 'MEDIAWIKI', true );
+define( 'MW_PHPUNIT_TEST', true );
 ini_set( 'include_path', "$IP:" .ini_get( 'include_path' ) );
 
-require ( "$IP/includes/Defines.php" );
-require ( "$IP/includes/DefaultSettings.php" );
-require ( "$IP/LocalSettings.php" );
+require "$IP/includes/Defines.php";
+require "$IP/includes/AutoLoader.php";
+require "$IP/LocalSettings.php";
 
-require 'ProfilerStub.php';
-require 'GlobalFunctions.php';
-require 'Hooks.php';
-require 'AutoLoader.php';
+require_once "$IP/includes/ProfilerStub.php";
+require_once "$IP/includes/GlobalFunctions.php";
+require_once "$IP/includes/Hooks.php";