Index: trunk/phase3/maintenance/tests/phpunit |
— | — | @@ -24,6 +24,18 @@ |
25 | 25 | EOF; |
26 | 26 | } |
27 | 27 | |
28 | | -$command = new PHPUnit_TextUI_Command; |
| 28 | +class MWPHPUnitCommand extends PHPUnit_TextUI_Command { |
| 29 | + protected function handleCustomTestSuite() { |
| 30 | + require( dirname( __FILE__ ) . '/TestFileList.php' ); |
| 31 | + $suite = new PHPUnit_Framework_TestSuite; |
| 32 | + foreach ( $testFiles as $file ) { |
| 33 | + $suite->addTestFile( $file ); |
| 34 | + } |
| 35 | + $suite->setName( 'MediaWiki test suite' ); |
| 36 | + $this->arguments['test'] = $suite; |
| 37 | + } |
| 38 | +} |
| 39 | + |
| 40 | +$command = new MWPHPUnitCommand; |
29 | 41 | $command->run( $argv ); |
30 | 42 | |
Index: trunk/phase3/maintenance/tests/ParserHelpers.php |
— | — | @@ -49,6 +49,10 @@ |
50 | 50 | return $result; |
51 | 51 | } |
52 | 52 | |
| 53 | + public function toString() { |
| 54 | + return $this->test['test']; |
| 55 | + } |
| 56 | + |
53 | 57 | } |
54 | 58 | |
55 | 59 | class ParserTestSuiteBackend extends ParserTest { |
Index: trunk/phase3/maintenance/tests/Makefile |
— | — | @@ -1,23 +1,32 @@ |
2 | | -# See |
3 | | -# http://lists.wikimedia.org/pipermail/wikitech-l/2010-February/046657.html |
4 | | -# for why prove(1) is the default target and not phpunit(1) |
| 2 | +# If you have problems with excessive memory usage, use the "tap" or "separate" targets. |
5 | 3 | |
6 | | -.PHONY: help test |
7 | | -all test: tap |
| 4 | +TEST_FILES=$(shell php -r 'include( "./TestFileList.php" ); echo implode( " ", $$testFiles );') |
| 5 | +TEST_FILE_TARGETS=$(subst .php,.target,$(TEST_FILES)) |
8 | 6 | |
9 | | -tap: |
10 | | - prove -e 'php phpunit.php --tap' *Test*.php |
| 7 | +.PHONY: help test phpunit tap separate install $(TEST_FILE_TARGETS) |
11 | 8 | |
| 9 | +all test: phpunit |
| 10 | + |
12 | 11 | phpunit: |
13 | | - phpunit |
| 12 | + php phpunit |
14 | 13 | |
| 14 | +tap: |
| 15 | + prove -e 'php phpunit --tap' *Test*.php |
| 16 | + |
| 17 | +separate: $(TEST_FILE_TARGETS) |
| 18 | + |
| 19 | +# Need --tap because without it, the target specification doesn't work |
| 20 | +$(TEST_FILE_TARGETS) : %.target : %.php |
| 21 | + php phpunit --tap $< |
| 22 | + |
15 | 23 | install: |
16 | 24 | pear channel-discover pear.phpunit.de |
17 | 25 | pear install phpunit/PHPUnit |
18 | 26 | |
19 | 27 | help: |
20 | | - # Options: |
21 | | - # test (default) Run the tests individually through Test::Harness's prove(1) |
22 | | - # phpunit Run all the tests with phpunit |
23 | | - # install Install PHPUnit from phpunit.de |
24 | | - # help You're looking at it! |
| 28 | + # Targets: |
| 29 | + # phpunit (default) Run all the tests with phpunit |
| 30 | + # separate Run each test file in a separate process |
| 31 | + # tap Run the tests individually through Test::Harness's prove(1) |
| 32 | + # install Install PHPUnit from phpunit.de |
| 33 | + # help You're looking at it! |
Index: trunk/phase3/maintenance/tests/phpunit.xml |
— | — | @@ -5,36 +5,8 @@ |
6 | 6 | convertErrorsToExceptions="true" |
7 | 7 | convertNoticesToExceptions="true" |
8 | 8 | convertWarningsToExceptions="true" |
9 | | - stopOnFailure="false"> |
10 | | - <testsuite name="MediaWiki Test Suite"> |
11 | | - <!-- <directory>.</directory> --> |
12 | | - <!-- <file>ApiTest.php</file> --> |
13 | | - <!-- <file>ApiWatchTest.php</file> --> |
14 | | - <file>CdbTest.php</file> |
15 | | - <file>DatabaseSqliteTest.php</file> |
16 | | - <file>DatabaseTest.php</file> |
17 | | - <file>GlobalTest.php</file> |
18 | | - <!--<file>HttpTest.php</file>--> |
19 | | - <file>IPTest.php</file> |
20 | | - <file>ImageFunctionsTest.php</file> |
21 | | - <file>LanguageConverterTest.php</file> |
22 | | - <file>LicensesTest.php</file> |
23 | | - <file>LocalFileTest.php</file> |
24 | | - <file>MediaWikiParserTest.php</file> |
25 | | - <file>MessageTest.php</file> |
26 | | - <file>RevisionTest.php</file> |
27 | | - <file>SanitizerTest.php</file> |
28 | | - <file>SearchDbTest.php</file> |
29 | | - <file>SearchEngineTest.php</file> |
30 | | - <file>SearchUpdateTest.php</file> |
31 | | - <file>SiteConfigurationTest.php</file> |
32 | | - <file>TimeAdjustTest.php</file> |
33 | | - <file>TitlePermissionTest.php</file> |
34 | | - <file>TitleTest.php</file> |
35 | | - <file>UploadTest.php</file> |
36 | | - <file>UploadFromUrlTestSuite.php</file> |
37 | | - <file>XmlTest.php</file> |
38 | | - </testsuite> |
| 9 | + stopOnFailure="false"> |
| 10 | + <!-- for the test file list, see TestFileList.php --> |
39 | 11 | <groups> |
40 | 12 | <exclude> |
41 | 13 | <group>Broken</group> |
Index: trunk/phase3/maintenance/tests/TestFileList.php |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$testFiles = array( |
| 5 | + #'ApiTest.php', |
| 6 | + #'ApiWatchTest.php', |
| 7 | + 'CdbTest.php', |
| 8 | + 'DatabaseSqliteTest.php', |
| 9 | + 'DatabaseTest.php', |
| 10 | + 'GlobalTest.php', |
| 11 | + #'HttpTest.php', |
| 12 | + 'IPTest.php', |
| 13 | + 'ImageFunctionsTest.php', |
| 14 | + 'LanguageConverterTest.php', |
| 15 | + 'LicensesTest.php', |
| 16 | + 'LocalFileTest.php', |
| 17 | + 'MediaWikiParserTest.php', |
| 18 | + 'MessageTest.php', |
| 19 | + 'RevisionTest.php', |
| 20 | + 'SanitizerTest.php', |
| 21 | + 'SearchDbTest.php', |
| 22 | + 'SearchEngineTest.php', |
| 23 | + 'SearchUpdateTest.php', |
| 24 | + 'SiteConfigurationTest.php', |
| 25 | + 'TimeAdjustTest.php', |
| 26 | + 'TitlePermissionTest.php', |
| 27 | + 'TitleTest.php', |
| 28 | + 'UploadTest.php', |
| 29 | + 'UploadFromUrlTestSuite.php', |
| 30 | + 'XmlTest.php', |
| 31 | +); |
Property changes on: trunk/phase3/maintenance/tests/TestFileList.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 32 | + native |
Index: trunk/phase3/maintenance/tests/MediaWikiParserTest.php |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | public function __construct() { |
13 | 13 | $this->backend = new ParserTestSuiteBackend; |
14 | 14 | parent::__construct(); |
| 15 | + $this->setName( 'Parser tests' ); |
15 | 16 | } |
16 | 17 | |
17 | 18 | public function run( PHPUnit_Framework_TestResult $result = null, $filter = false, |
Index: trunk/phase3/includes/specials/SpecialSelenium.php |
— | — | @@ -48,6 +48,7 @@ |
49 | 49 | $result = new PHPUnit_Framework_TestResult; |
50 | 50 | $logger = new SeleniumTestHTMLLogger; |
51 | 51 | $result->addListener( new SeleniumTestListener( $logger ) ); |
| 52 | + $logger->setHeaders(); |
52 | 53 | |
53 | 54 | // run tests |
54 | 55 | $suite = new SeleniumTestSuite; |