Index: trunk/phase3/maintenance/tests/phpunit/bootstrap.php |
— | — | @@ -1,32 +1,19 @@ |
2 | | -<?php |
| 2 | +<?php |
3 | 3 | /** |
4 | 4 | * Bootstrapping for MediaWiki PHPUnit tests |
5 | | - * |
| 5 | + * This file is included by phpunit and is NOT in the global scope. |
| 6 | + * |
6 | 7 | * @file |
7 | 8 | */ |
8 | 9 | |
9 | | -/* Configuration */ |
| 10 | +if ( !defined( 'MW_PHPUNIT_TEST' ) ) { |
| 11 | + echo <<<EOF |
| 12 | +You are running these tests directly from phpunit. You may not have all globals correctly set. |
| 13 | +Running phpunit.php instead is recommended. |
| 14 | +EOF; |
| 15 | + require_once ( dirname( __FILE__ ) . "/phpunit.php" ); |
| 16 | +} |
10 | 17 | |
11 | | -// This file is not included in the global scope, but rather within a function, so we must global anything we need to |
12 | | -// have access to in the global scope explicitly |
13 | | -global $wgCommandLineMode, $IP, $optionsWithArgs, $wgProfiler, $wgAutoloadClasses; |
14 | | - |
15 | | -// Evaluate the include path relative to this file |
16 | | -$IP = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
17 | | - |
18 | | -// Set a flag which can be used to detect when other scripts have been entered through this entry point or not |
19 | | -define( 'MW_PHPUNIT_TEST', true ); |
20 | | - |
21 | | -// Start up MediaWiki in command-line mode |
22 | | -require_once( "$IP/maintenance/commandLine.inc" ); |
23 | | - |
24 | | -// Assume UTC for testing purposes |
25 | | -$wgLocaltimezone = 'UTC'; |
26 | | - |
27 | | -// To prevent tests from failing with SQLite, we need to turn database caching off |
28 | | -global $wgCaches; |
29 | | -$wgCaches[CACHE_DB] = false; |
30 | | - |
31 | 18 | // Output a notice when running with older versions of PHPUnit |
32 | 19 | if ( !version_compare( PHPUnit_Runner_Version::id(), "3.4.1", ">" ) ) { |
33 | 20 | echo <<<EOF |
— | — | @@ -74,3 +61,4 @@ |
75 | 62 | } |
76 | 63 | } |
77 | 64 | } |
| 65 | + |
Index: trunk/phase3/maintenance/tests/phpunit/Makefile |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | SHELL = /bin/sh |
5 | 5 | CONFIG_FILE = $(shell pwd)/suite.xml |
6 | 6 | FLAGS = |
7 | | -PU = phpunit --configuration ${CONFIG_FILE} |
| 7 | +PU = php phpunit.php --configuration ${CONFIG_FILE} |
8 | 8 | |
9 | 9 | all test: warning |
10 | 10 | |
Index: trunk/phase3/maintenance/tests/phpunit/phpunit.php |
— | — | @@ -0,0 +1,27 @@ |
| 2 | +#!/usr/bin/env php |
| 3 | +<?php |
| 4 | +/** |
| 5 | + * Bootstrapping for MediaWiki PHPUnit tests |
| 6 | + * |
| 7 | + * @file |
| 8 | + */ |
| 9 | + |
| 10 | +/* Configuration */ |
| 11 | + |
| 12 | +// Evaluate the include path relative to this file |
| 13 | +$IP = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
| 14 | + |
| 15 | +// Set a flag which can be used to detect when other scripts have been entered through this entry point or not |
| 16 | +define( 'MW_PHPUNIT_TEST', true ); |
| 17 | + |
| 18 | +// Start up MediaWiki in command-line mode |
| 19 | +require_once( "$IP/maintenance/commandLine.inc" ); |
| 20 | + |
| 21 | +// Assume UTC for testing purposes |
| 22 | +$wgLocaltimezone = 'UTC'; |
| 23 | + |
| 24 | +// To prevent tests from failing with SQLite, we need to turn database caching off |
| 25 | +$wgCaches[CACHE_DB] = false; |
| 26 | + |
| 27 | +require_once "/usr/bin/phpunit"; |
| 28 | + |
Property changes on: trunk/phase3/maintenance/tests/phpunit/phpunit.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 29 | + native |
Added: svn:executable |
2 | 30 | + * |