Index: branches/phpunit-restructure/maintenance/tests/phpunit.sh |
— | — | @@ -0,0 +1,54 @@ |
| 2 | +#!/usr/bin/env php |
| 3 | +<?php |
| 4 | + |
| 5 | +require( dirname( __FILE__ ) . '/../commandLine.inc' ); |
| 6 | +// XXX: This can go away if everyone switches to PHPUnit 3.5 |
| 7 | +if ( @file_get_contents( 'PHPUnit/Autoload.php', true ) !== false ) { |
| 8 | + // Works for PHPUnit >= 3.5 |
| 9 | + require_once 'PHPUnit/Autoload.php'; |
| 10 | +} else { |
| 11 | + // Works for PHPUnit < 3.5 |
| 12 | + require_once 'PHPUnit/TextUI/Command.php'; |
| 13 | +} |
| 14 | +define( 'MW_PHPUNIT_TEST', 1 ); |
| 15 | + |
| 16 | +$wgLocaltimezone = 'UTC'; |
| 17 | + |
| 18 | +/* Tests were failing with sqlite */ |
| 19 | +global $wgCaches; |
| 20 | +$wgCaches[CACHE_DB] = false; |
| 21 | + |
| 22 | +if ( !version_compare( PHPUnit_Runner_Version::id(), "3.4.1", ">" ) ) { |
| 23 | + echo <<<EOF |
| 24 | +************************************************************ |
| 25 | + |
| 26 | +These tests run best with version PHPUnit 3.4.2 or later. |
| 27 | +Earlier versions may show failures because earlier versions |
| 28 | +of PHPUnit do not properly implement dependencies. |
| 29 | + |
| 30 | +************************************************************ |
| 31 | + |
| 32 | +EOF; |
| 33 | +} |
| 34 | + |
| 35 | +class MWPHPUnitCommand extends PHPUnit_TextUI_Command { |
| 36 | + protected function handleCustomTestSuite() { |
| 37 | + $suite = new PHPUnit_Framework_TestSuite; |
| 38 | + if ( !empty( $this->options[1] ) ) { |
| 39 | + $files = $this->options[1]; |
| 40 | + } else { |
| 41 | + require( dirname( __FILE__ ) . '/TestFileList.php' ); |
| 42 | + $files = $testFiles; |
| 43 | + wfRunHooks( 'UnitTestsList', array( &$files ) ); |
| 44 | + } |
| 45 | + foreach ( $files as $file ) { |
| 46 | + $suite->addTestFile( $file ); |
| 47 | + } |
| 48 | + $suite->setName( 'MediaWiki test suite' ); |
| 49 | + $this->arguments['test'] = $suite; |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +$command = new MWPHPUnitCommand; |
| 54 | +$command->run( $argv ); |
| 55 | + |
Property changes on: branches/phpunit-restructure/maintenance/tests/phpunit.sh |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 56 | + native |
Added: svn:executable |
2 | 57 | + * |