693544137eebe093b967adedc10f8dbe9f6839bc
[lhc/web/wiklou.git] / tests / phpunit / phpunit.php
1 #!/usr/bin/env php
2 <?php
3 /**
4 * Bootstrapping for MediaWiki PHPUnit tests
5 *
6 * @file
7 */
8
9 /* Configuration */
10
11 // Evaluate the include path relative to this file
12 $IP = dirname( dirname( dirname( __FILE__ ) ) );
13
14 // Set a flag which can be used to detect when other scripts have been entered through this entry point or not
15 define( 'MW_PHPUNIT_TEST', true );
16
17 // Start up MediaWiki in command-line mode
18 require_once( "$IP/maintenance/commandLine.inc" );
19
20 // Assume UTC for testing purposes
21 $wgLocaltimezone = 'UTC';
22
23 if( !in_array( '--configuration', $_SERVER['argv'] ) ) {
24 //Hack to eliminate the need to use the Makefile (which sucks ATM)
25 $_SERVER['argv'][] = '--configuration';
26 $_SERVER['argv'][] = $IP . '/tests/phpunit/suite.xml';
27 }
28
29 require_once( 'PHPUnit/Runner/Version.php' );
30 if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) {
31 # PHPUnit 3.5.0 introduced a nice autoloader based on class name
32 require_once( 'PHPUnit/Autoload.php' );
33 } else {
34 # Keep the old pre PHPUnit 3.5.0 behaviour for compatibility
35 require_once( 'PHPUnit/TextUI/Command.php' );
36 }
37
38 $additionalMWCLIArgs = array(
39 'verbose' => false,
40 );
41
42 require_once( "$IP/tests/phpunit/MediaWikiPHPUnitCommand.php" );
43 require_once( "$IP/tests/phpunit/MediaWikiTestCase.php" );
44 MediaWikiPHPUnitCommand::main();
45