r112331 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112330‎ | r112331 | r112332 >
Date:16:54, 24 February 2012
Author:hashar
Status:ok
Tags:
Comment:
better structure filename error output

When dumping an array, PHPUnit limit the number of characters shown. That would
just hide the relevant part of the path:

1) StructureTest::testUnitTestFileNamesEndWithTest
[...]
Array (
+ 0 => '/some/path/tests/phpunit/incl...ge.php'
+ 1 => '/some/path/tests/phpunit/incl...ki.php'
)

By stripping the common path ( /some/path/tests/phpunit ), we end up with a
more useful output:

Array (
+ 0 => 'includes/RecentChange.php'
+ 1 => 'includes/Wiki.php'
)
Modified paths:
  • /trunk/phase3/tests/phpunit/StructureTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/StructureTest.php
@@ -39,11 +39,14 @@
4040 $results,
4141 array( $this, 'filterSuites' )
4242 );
43 -
 43+ $strip = strlen( $rootPath ) - 1;
 44+ foreach( $results as $k => $v) {
 45+ $results[$k] = substr( $v, $strip );
 46+ }
4447 $this->assertEquals(
4548 array(),
4649 $results,
47 - 'Unit test file names must end with Test.'
 50+ "Unit test file in $rootPath must end with Test."
4851 );
4952 }
5053

Status & tagging log