From 9560e00cf3e5eaec2f047183165fb89ecdd2f630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 19 May 2025 09:50:54 +0200 Subject: [PATCH] chore: Remove useless legacy autoloader for tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/autoloader.php | 4 ---- lib/base.php | 3 --- tests/lib/AutoLoaderTest.php | 6 ------ tests/lib/Files/Storage/Wrapper/QuotaTest.php | 2 -- 4 files changed, 15 deletions(-) diff --git a/lib/autoloader.php b/lib/autoloader.php index 7084eb93c89d4..2a95f5944a310 100644 --- a/lib/autoloader.php +++ b/lib/autoloader.php @@ -95,10 +95,6 @@ public function findClass(string $class): array { } catch (AppPathNotFoundException) { // App not found, ignore } - } elseif ($class === 'Test\\TestCase') { - // This File is considered public API, so we make sure that the class - // can still be loaded, although the PSR-4 paths have not been loaded. - $paths[] = \OC::$SERVERROOT . '/tests/lib/TestCase.php'; } return $paths; } diff --git a/lib/base.php b/lib/base.php index 639568cf64059..75f5cfee3e814 100644 --- a/lib/base.php +++ b/lib/base.php @@ -601,9 +601,6 @@ public static function init(): void { self::$loader = new \OC\Autoloader([ OC::$SERVERROOT . '/lib/private/legacy', ]); - if (defined('PHPUNIT_RUN')) { - self::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); - } spl_autoload_register([self::$loader, 'load']); $loaderEnd = microtime(true); diff --git a/tests/lib/AutoLoaderTest.php b/tests/lib/AutoLoaderTest.php index 72d4a2e94cf52..9fef8f5280d52 100644 --- a/tests/lib/AutoLoaderTest.php +++ b/tests/lib/AutoLoaderTest.php @@ -24,12 +24,6 @@ public function testLegacyPath(): void { ], $this->loader->findClass('OC_JSON')); } - public function testLoadTestTestCase(): void { - $this->assertEquals([ - \OC::$SERVERROOT . '/tests/lib/TestCase.php' - ], $this->loader->findClass('Test\TestCase')); - } - public function testLoadCore(): void { $this->assertEquals([ \OC::$SERVERROOT . '/lib/private/legacy/foo/bar.php', diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php index 791e8047f7f7c..3115f1288a0b6 100644 --- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php +++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php @@ -12,8 +12,6 @@ use OC\Files\Storage\Local; use OCP\Files; -\OC::$loader->load('\OC\Files\Filesystem'); - /** * Class QuotaTest *