summaryrefslogtreecommitdiff
path: root/tests/phpunit/structure/AutoLoaderTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-04-25 06:26:49 +0200
committerPierre Schmitz <pierre@archlinux.de>2014-04-25 06:26:49 +0200
commit2e44b49a2db3026050b136de9b00f749dd3ff939 (patch)
treeef048f4db79a93c25cfc86319264aa7ae2a4ae0b /tests/phpunit/structure/AutoLoaderTest.php
parent9441dde8bfb95277df073717ed7817dced40f948 (diff)
Update to MediaWiki 1.22.6
Diffstat (limited to 'tests/phpunit/structure/AutoLoaderTest.php')
-rw-r--r--tests/phpunit/structure/AutoLoaderTest.php56
1 files changed, 0 insertions, 56 deletions
diff --git a/tests/phpunit/structure/AutoLoaderTest.php b/tests/phpunit/structure/AutoLoaderTest.php
deleted file mode 100644
index 205ea360..00000000
--- a/tests/phpunit/structure/AutoLoaderTest.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-class AutoLoaderTest extends MediaWikiTestCase {
-
- /**
- * Assert that there were no classes loaded that are not registered with the AutoLoader.
- *
- * For example foo.php having class Foo and class Bar but only registering Foo.
- * This is important because we should not be relying on Foo being used before Bar.
- */
- public function testAutoLoadConfig() {
- $results = self::checkAutoLoadConf();
-
- $this->assertEquals(
- $results['expected'],
- $results['actual']
- );
- }
-
- protected static function checkAutoLoadConf() {
- global $wgAutoloadLocalClasses, $wgAutoloadClasses, $IP;
- $supportsParsekit = function_exists( 'parsekit_compile_file' );
-
- // wgAutoloadLocalClasses has precedence, just like in includes/AutoLoader.php
- $expected = $wgAutoloadLocalClasses + $wgAutoloadClasses;
- $actual = array();
-
- $files = array_unique( $expected );
-
- foreach ( $files as $file ) {
- // Only prefix $IP if it doesn't have it already.
- // Generally local classes don't have it, and those from extensions and test suites do.
- if ( substr( $file, 0, 1 ) != '/' && substr( $file, 1, 1 ) != ':' ) {
- $filePath = "$IP/$file";
- } else {
- $filePath = $file;
- }
- if ( $supportsParsekit ) {
- $parseInfo = parsekit_compile_file( "$filePath" );
- $classes = array_keys( $parseInfo['class_table'] );
- } else {
- $contents = file_get_contents( "$filePath" );
- $m = array();
- preg_match_all( '/\n\s*(?:final)?\s*(?:abstract)?\s*(?:class|interface)\s+([a-zA-Z0-9_]+)/', $contents, $m, PREG_PATTERN_ORDER );
- $classes = $m[1];
- }
- foreach ( $classes as $class ) {
- $actual[$class] = $file;
- }
- }
-
- return array(
- 'expected' => $expected,
- 'actual' => $actual,
- );
- }
-}