From fc324a18d261b0347023a8c6658aa66ded70e755 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Fri, 24 Feb 2012 16:54:48 +0000 Subject: [PATCH] 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' ) --- tests/phpunit/StructureTest.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/StructureTest.php b/tests/phpunit/StructureTest.php index f967c18d09..6953ab665f 100644 --- a/tests/phpunit/StructureTest.php +++ b/tests/phpunit/StructureTest.php @@ -39,11 +39,14 @@ class StructureTest extends MediaWikiTestCase { $results, array( $this, 'filterSuites' ) ); - + $strip = strlen( $rootPath ) - 1; + foreach( $results as $k => $v) { + $results[$k] = substr( $v, $strip ); + } $this->assertEquals( array(), $results, - 'Unit test file names must end with Test.' + "Unit test file in $rootPath must end with Test." ); } -- 2.20.1