From: Chad Horohoe Date: Wed, 16 Jul 2014 00:49:18 +0000 (-0700) Subject: Make AutoLoaderTest handle namespaces X-Git-Tag: 1.31.0-rc.0~14925^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=f45e4de3b748963a70512ad0684aaba409461780;p=lhc%2Fweb%2Fwiklou.git Make AutoLoaderTest handle namespaces Bug: 67644 Change-Id: Ibeb0833742c574afac13bfebd278f9d2b8410de6 --- diff --git a/tests/phpunit/structure/AutoLoaderTest.php b/tests/phpunit/structure/AutoLoaderTest.php index 12f147e9bd..2bdc9c9a22 100644 --- a/tests/phpunit/structure/AutoLoaderTest.php +++ b/tests/phpunit/structure/AutoLoaderTest.php @@ -74,13 +74,23 @@ class AutoLoaderTest extends MediaWikiTestCase { ) /imx', $contents, $matches, PREG_SET_ORDER ); + $namespaceMatch = array(); + preg_match( '/ + ^ [\t ]* + namespace \s+ + ([a-zA-Z0-9_]+(\\\\[a-zA-Z0-9_]+)*) + \s* ; + /imx', $contents, $namespaceMatch ); + $fileNamespace = $namespaceMatch ? $namespaceMatch[1] . '\\' : ''; + $classesInFile = array(); $aliasesInFile = array(); foreach ( $matches as $match ) { if ( !empty( $match['class'] ) ) { - $actual[$match['class']] = $file; - $classesInFile[$match['class']] = true; + $class = $fileNamespace . $match['class']; + $actual[$class] = $file; + $classesInFile[$class] = true; } else { $aliasesInFile[$match['alias']] = $match['original']; }