r72560 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72559‎ | r72560 | r72561 >
Date:22:32, 7 September 2010
Author:tparscal
Status:ok (Comments)
Tags:
Comment:
Renaming phpunit to phpunit.php - this will make it possible to have a phpunit folder here, yet doesn't break head.
Modified paths:
  • /trunk/phase3/maintenance/tests/Makefile (modified) (history)
  • /trunk/phase3/maintenance/tests/phpunit (deleted) (history)
  • /trunk/phase3/maintenance/tests/phpunit.php (added) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/phpunit
@@ -1,54 +0,0 @@
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 -
Index: trunk/phase3/maintenance/tests/Makefile
@@ -8,16 +8,16 @@
99 all test: phpunit
1010
1111 phpunit:
12 - php phpunit
 12+ php phpunit.php
1313
1414 tap:
15 - prove -e 'php phpunit --tap' *Test*.php
 15+ prove -e 'php phpunit.php --tap' *Test*.php
1616
1717 separate: $(TEST_FILE_TARGETS)
1818
1919 # Need --tap because without it, the target specification doesn't work
2020 $(TEST_FILE_TARGETS) : %.target : %.php
21 - php phpunit --tap $<
 21+ php phpunit.php --tap $<
2222
2323 install:
2424 pear channel-discover pear.phpunit.de
Index: trunk/phase3/maintenance/tests/phpunit.php
@@ -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: trunk/phase3/maintenance/tests/phpunit.php
___________________________________________________________________
Added: svn:eol-style
156 + native
Added: svn:executable
257 + *

Comments

#Comment by Bryan (talk | contribs)   11:32, 8 September 2010

This causes a lot of tests to fail, and UploadFromUrlTest to fatal, but only if it is run after other tests (i.e. it does not fatal with --filter "UploadFrom*")

D:\wwwroot\phase3\maintenance\tests\phpunit>phpunit --configuration suite.xml --verbose
PHPUnit 3.4.15 by Sebastian Bergmann.

Test Suite
 includes
   ApiTest
  ........I

  ApiWatchTest
  F.....E.

  CdbTest
  I

  DatabaseSqliteTest
  II

  DatabaseTest
  .........

  ExtraParserTest
  .

  GlobalTest
  ...........

  HttpTest
  IIIIIIIIIIIIIIIIIIIIIIIIII

  ImageFunctionsTest
  .

  IPTest
  ....

  LanguageConverterTest
  .........

  LicensesTest


  LocalFileTest
  ...........

  MessageTest
  ....

  Parser tests
  ..........................................................
  ..........................................................
  ..........................................................
  ..........................................................
  ...........................................F.......FFFFFF.
  ......F.F.................................................
  ..........................................................
  ..........................................................
  ......................................F...................
  ..................................................F.......
  ..........................

  ParserUnitTest
  F

  ResourceLoaderFileModuleTest
  .

  ResourceLoaderTest
  .

  RevisionTest
  ........

  SanitizerTest
  ........

  SearchDbTest
  .....

  SearchUpdateTest
  .

  SiteConfigurationTest
  ......

  TimeAdjustTest
  .

  TitlePermissionTest
  ........

  TitleTest
  .

  UploadFromUrlTest
  ...PHP Fatal error:  Call to a member function getCode() on a non-object in D:\wwwroot\phase3\includes\parser\ParserOptions.php on line 210

Fatal error: Call to a member function getCode() on a non-object in D:\wwwroot\phase3\includes\parser\ParserOptions.php on line 210

D:\wwwroot\phase3\maintenance\tests\phpunit>
#Comment by Bryan (talk | contribs)   11:33, 8 September 2010

Oops, posted in the wrong commit.

Status & tagging log