Remove unused global $IP
[lhc/web/wiklou.git] / maintenance / tests / phpunit
1 #!/usr/bin/env php
2 <?php
3
4 require( dirname( __FILE__ ) . '/../commandLine.inc' );
5 require 'PHPUnit/TextUI/Command.php';
6 define( 'MW_PHPUNIT_TEST', 1 );
7
8 $wgLocaltimezone = 'UTC';
9
10 /* Tests were failing with sqlite */
11 global $wgCaches;
12 $wgCaches[CACHE_DB] = false;
13
14 if ( !version_compare( PHPUnit_Runner_Version::id(), "3.4.1", ">" ) ) {
15 echo <<<EOF
16 ************************************************************
17
18 These tests run best with version PHPUnit 3.4.2 or later.
19 Earlier versions may show failures because earlier versions
20 of PHPUnit do not properly implement dependencies.
21
22 ************************************************************
23
24 EOF;
25 }
26
27 class MWPHPUnitCommand extends PHPUnit_TextUI_Command {
28 protected function handleCustomTestSuite() {
29 $suite = new PHPUnit_Framework_TestSuite;
30 if ( !empty( $this->options[1] ) ) {
31 $files = $this->options[1];
32 } else {
33 require( dirname( __FILE__ ) . '/TestFileList.php' );
34 $files = $testFiles;
35 wfRunHooks( 'UnitTestsList', array( &$files ) );
36 }
37 foreach ( $files as $file ) {
38 $suite->addTestFile( $file );
39 }
40 $suite->setName( 'MediaWiki test suite' );
41 $this->arguments['test'] = $suite;
42 }
43 }
44
45 $command = new MWPHPUnitCommand;
46 $command->run( $argv );
47