diff --git a/apps/admin_audit/composer/autoload.php b/apps/admin_audit/composer/autoload.php deleted file mode 100644 index 7480b576ba0e7..0000000000000 --- a/apps/admin_audit/composer/autoload.php +++ /dev/null @@ -1,22 +0,0 @@ -getStats()); exit($exitCode); } catch (Exception $ex) { exceptionHandler($ex); diff --git a/lib/OC.php b/lib/OC.php index a39f15f0bba4b..53e66bc17116d 100644 --- a/lib/OC.php +++ b/lib/OC.php @@ -38,6 +38,9 @@ require_once __DIR__ . '/public/Constants.php'; +// There is no autoloading for functions so we need to hardcode it +require_once __DIR__ . '/public/Log/functions.php'; + /** * Class that is a namespace for all global OC variables * @internal @@ -87,6 +90,7 @@ class OC { * @psalm-suppress ImpureStaticProperty */ public static \Composer\Autoload\ClassLoader $composerAutoloader; + public static \OC\Autoloader $autoloader; /** * @psalm-suppress ImpureStaticProperty @@ -679,14 +683,38 @@ public static function boot(): void { // calculate the root directories OC::$SERVERROOT = str_replace('\\', '/', substr(__DIR__, 0, -4)); + // No autoloader yet, manually load Config class + require_once __DIR__ . '/private/Config.php'; + + // load configs + if (defined('PHPUNIT_CONFIG_DIR')) { + self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/'; + } elseif (defined('PHPUNIT_RUN') && PHPUNIT_RUN && is_dir(OC::$SERVERROOT . '/tests/config/')) { + self::$configDir = OC::$SERVERROOT . '/tests/config/'; + } elseif ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { + self::$configDir = rtrim($dir, '/') . '/'; + } else { + self::$configDir = OC::$SERVERROOT . '/config/'; + } + self::$config = new \OC\Config(self::$configDir); + + $cacheDirectory = self::$config->getValue('cachedirectory', OC::$SERVERROOT . '/cache'); + // register autoloader self::$loaderStart = microtime(true); self::$CLI = (php_sapi_name() == 'cli'); - // Add default composer PSR-4 autoloader, ensure apcu to be disabled - self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php'; - self::$composerAutoloader->setApcuPrefix(null); + require_once __DIR__ . '/private/PhpDumpCache.php'; + require_once __DIR__ . '/private/Autoloader.php'; + $phpDumpCache = new \OC\PhpDumpCache($cacheDirectory); + self::$autoloader = new \OC\Autoloader($phpDumpCache); + self::$autoloader->addPsr4('OC', OC::$SERVERROOT . '/lib/private'); + self::$autoloader->addPsr4('OCP', OC::$SERVERROOT . '/lib/public'); + self::$autoloader->addPsr4('NCU', OC::$SERVERROOT . '/lib/unstable'); + self::$autoloader->addPsr4('OC\\Core', OC::$SERVERROOT . '/core'); + self::$autoloader->addPsr4('', OC::$SERVERROOT . '/lib/private/legacy'); + self::$autoloader->register(); // setup 3rdparty autoloader $vendorAutoLoad = OC::$SERVERROOT . '/3rdparty/autoload.php'; @@ -697,18 +725,6 @@ public static function boot(): void { self::$loaderEnd = microtime(true); - // load configs - if (defined('PHPUNIT_CONFIG_DIR')) { - self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/'; - } elseif (defined('PHPUNIT_RUN') && PHPUNIT_RUN && is_dir(OC::$SERVERROOT . '/tests/config/')) { - self::$configDir = OC::$SERVERROOT . '/tests/config/'; - } elseif ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { - self::$configDir = rtrim($dir, '/') . '/'; - } else { - self::$configDir = OC::$SERVERROOT . '/config/'; - } - self::$config = new \OC\Config(self::$configDir); - // Enable lazy loading if activated \OC\AppFramework\Utility\SimpleContainer::$useLazyObjects = (bool)self::$config->getValue('enable_lazy_objects', true); diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 3edeeec27e108..e27f98e400e89 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -83,6 +83,8 @@ class AppManager implements IAppManager { /** @var array */ private array $loadedApps = []; + /** @var array */ + private array $registeredApps = []; /** @var string[] */ private $namespaceCache = []; @@ -267,22 +269,12 @@ public function loadApps(array $types = []): bool { // Load the enabled apps here $apps = $this->getEnabledApps(); - - // Add each apps' folder as allowed class path - foreach ($apps as $app) { + $appsToRegister = array_filter( + $apps, // If the app is already loaded then autoloading it makes no sense - if (!$this->isAppLoaded($app) && ($types === [] || $this->isType($app, $types))) { - try { - $path = $this->getAppPath($app); - \OC_App::registerAutoloading($app, $path); - } catch (AppPathNotFoundException $e) { - $this->logger->info('Error during app loading: ' . $e->getMessage(), [ - 'exception' => $e, - 'app' => $app, - ]); - } - } - } + fn (string $app) => (!$this->isAppLoaded($app) && ($types === [] || $this->isType($app, $types))), + ); + $this->registerAppsAutoloading($appsToRegister); // prevent app loading from printing output ob_start(); @@ -487,7 +479,7 @@ public function loadApp(string $app): void { $eventLogger->start("bootstrap:load_app:$app", "Load app: $app"); // in case someone calls loadApp() directly - \OC_App::registerAutoloading($app, $appPath); + $this->registerAppsAutoloading([$app]); if (is_file($appPath . '/appinfo/app.php')) { $this->logger->error('/appinfo/app.php is not supported anymore, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead.', [ @@ -578,6 +570,60 @@ public function loadApp(string $app): void { $eventLogger->end("bootstrap:load_app:$app"); } + /** + * @internal + */ + public function registerAppsAutoloading(array $apps): void { + $reload = false; + foreach ($apps as $app) { + if (!isset($this->registeredApps[$app])) { + try { + $path = $this->getAppPath($app); + $this->registerAutoloading($app, $path); + $reload = true; + } catch (AppPathNotFoundException $e) { + $this->logger->info('Error during app loading: ' . $e->getMessage(), [ + 'exception' => $e, + 'app' => $app, + ]); + } + } + } + if ($reload) { + \OC::$autoloader->triggerReload(); + } + } + + /** + * @internal + */ + public function registerAutoloading(string $app, string $path, bool $force = false): void { + if (!$force && isset($this->registeredApps[$app])) { + return; + } + + $this->registeredApps[$app] = true; + + // Register on PSR-4 composer autoloader + $appNamespace = $this->getAppNamespace($app); + \OC::$server->registerNamespace($app, $appNamespace); + + if (file_exists($path . '/composer/autoload.php')) { + require_once $path . '/composer/autoload.php'; + } elseif (is_dir($path . '/lib')) { + // autoloader crashes on non-existing dir + \OC::$autoloader->addPsr4($appNamespace, $path . '/lib/'); + } + + // Register Test namespace only when testing + if ((defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) && is_dir($path . '/tests/')) { + \OC::$autoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/'); + } + if ($force) { + \OC::$autoloader->triggerReload(); + } + } + /** * Check if an app is loaded * @param string $app app id @@ -1107,7 +1153,7 @@ public function upgradeApp(string $appId): bool { $ignoreMax = in_array($appId, $ignoreMaxApps, true); $this->checkAppDependencies($appId, $ignoreMax); - \OC_App::registerAutoloading($appId, $appPath, true); + $this->registerAutoloading($appId, $appPath, true); $this->executeRepairSteps($appId, $appInfo['repair-steps']['pre-migration']); $ms = new MigrationService($appId, Server::get(\OC\DB\Connection::class)); diff --git a/lib/private/AppFramework/Bootstrap/Coordinator.php b/lib/private/AppFramework/Bootstrap/Coordinator.php index 9912e2c901337..7d8772404c383 100644 --- a/lib/private/AppFramework/Bootstrap/Coordinator.php +++ b/lib/private/AppFramework/Bootstrap/Coordinator.php @@ -10,8 +10,6 @@ namespace OC\AppFramework\Bootstrap; use OC\Support\CrashReport\Registry; -use OC_App; -use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootstrap; @@ -66,21 +64,12 @@ private function registerApps(array $appIds): void { if ($this->registrationContext === null) { $this->registrationContext = new RegistrationContext($this->logger); } + $this->eventLogger->start('bootstrap:register_app:autoloader', 'Setup autoloader for apps'); + $this->appManager->registerAppsAutoloading($appIds); + $this->eventLogger->end('bootstrap:register_app:autoloader'); $apps = []; foreach ($appIds as $appId) { $this->eventLogger->start("bootstrap:register_app:$appId", "Register $appId"); - $this->eventLogger->start("bootstrap:register_app:$appId:autoloader", "Setup autoloader for $appId"); - /* - * First, we have to enable the app's autoloader - */ - try { - $path = $this->appManager->getAppPath($appId); - OC_App::registerAutoloading($appId, $path); - } catch (AppPathNotFoundException) { - // Ignore - continue; - } - $this->eventLogger->end("bootstrap:register_app:$appId:autoloader"); /* * Next we check if there is an application class, and it implements diff --git a/lib/private/Autoloader.php b/lib/private/Autoloader.php new file mode 100644 index 0000000000000..44104807cfefc --- /dev/null +++ b/lib/private/Autoloader.php @@ -0,0 +1,474 @@ + namespace => path */ + private array $psr4Paths = []; + + /** @var string[] */ + private array $excludeDirs = []; + + /** @var array class => [file, time] */ + private array $classes = []; + private bool $cacheLoaded = false; + private bool $refreshed = false; + + /** @var array class => counter */ + private array $missingClasses = []; + + /** @var array file => mtime */ + private array $emptyFiles = []; + private bool $needSave = false; + + private int $loadsFromCache = 0; + private int $diskScans = 0; + + public function __construct( + private PhpDumpCache $dumpCache, + ) { + if (!extension_loaded('tokenizer')) { + throw new \LogicException('PHP extension Tokenizer is not loaded.'); + } + } + + public function __destruct() { + if ($this->needSave) { + $this->saveCache(); + } + } + + /** + * Register autoloader. + */ + public function register(bool $prepend = false): static { + spl_autoload_register([$this, 'tryLoad'], prepend: $prepend); + return $this; + } + + /** + * Handles autoloading of classes, interfaces or traits. + */ + public function tryLoad(string $type): void { + try { + $this->loadCache(); + + $missing = $this->missingClasses[$type] ?? 0; + if ($missing >= self::RetryLimit) { + return; + } + + [$file, $mtime] = $this->classes[$type] ?? null; + + if ($this->autoRebuild) { + if (!$this->refreshed) { + if (!$file || !is_file($file)) { + $this->refreshClasses(); + [$file] = $this->classes[$type] ?? null; + $this->needSave = true; + + } elseif (filemtime($file) !== $mtime) { + $this->updateFile($file); + [$file] = $this->classes[$type] ?? null; + $this->needSave = true; + } + } + + if (!$file || !is_file($file)) { + $this->missingClasses[$type] = ++$missing; + $this->needSave = $this->needSave || $file || ($missing <= self::RetryLimit); + unset($this->classes[$type]); + $file = null; + } + } + + if ($file) { + (static function ($file) { + require $file; + })($file); + } + } catch (\Throwable $t) { + throw $t; + } + } + + /** + * Add path or paths to list. + */ + public function addDirectory(string ...$paths): static { + $this->scanPaths = array_merge($this->scanPaths, $paths); + $this->refreshed = false; + $this->cacheLoaded = false; + return $this; + } + + /** + * Add path for given namespace + */ + public function addPsr4(string $namespace, string $path): static { + $path = trim($path, '/'); + $namespace = trim($namespace, '\\'); + $this->psr4Paths[$namespace] = '/' . $path; + return $this; + } + + public function triggerReload(): void { + $this->refreshed = false; + $this->cacheLoaded = false; + } + + public function reportParseErrors(bool $on = true): static { + $this->reportParseErrors = $on; + return $this; + } + + /** + * Excludes path or paths from list. + */ + public function excludeDirectory(string ...$paths): static { + $this->excludeDirs = array_merge($this->excludeDirs, $paths); + return $this; + } + + /** + * @return array class => filename + */ + public function getIndexedClasses(): array { + $this->loadCache(); + $res = []; + foreach ($this->classes as $class => [$file]) { + $res[$class] = $file; + } + + return $res; + } + + /** + * Rebuilds class list cache. + */ + public function rebuild(): void { + $this->cacheLoaded = true; + $this->classes = $this->missingClasses = $this->emptyFiles = []; + $this->refreshClasses(); + $this->saveCache(); + } + + /** + * Refreshes class list cache. + */ + public function refresh(): void { + $this->loadCache(); + if (!$this->refreshed) { + $this->refreshClasses(); + $this->saveCache(); + } + } + + /** + * Refreshes $this->classes & $this->emptyFiles. + */ + private function refreshClasses(): void { + $this->refreshed = true; // prevents calling refreshClasses() or updateFile() in tryLoad() + $files = $this->emptyFiles; + $classes = []; + foreach ($this->classes as $class => [$file, $mtime]) { + $files[$file] = $mtime; + $classes[$file][] = $class; + } + + $this->classes = $this->emptyFiles = []; + + foreach ($this->scanPaths as $path) { + $iterator = is_file($path) + ? [$path] + : $this->createFileIterator($path); + + foreach ($iterator as $file) { + $mtime = filemtime($file); + $foundClasses = isset($files[$file]) && $files[$file] === $mtime + ? ($classes[$file] ?? []) + : $this->scanPhp($file); + + if (!$foundClasses) { + $this->emptyFiles[$file] = $mtime; + } + + $files[$file] = $mtime; + $classes[$file] = []; // prevents the error when adding the same file twice + + foreach ($foundClasses as $class) { + if (isset($this->classes[$class])) { + throw new \RuntimeException(sprintf( + 'Ambiguous class %s resolution; defined in %s and in %s.', + $class, + $this->classes[$class][0], + $file, + )); + } + + $this->classes[$class] = [$file, $mtime]; + unset($this->missingClasses[$class]); + } + } + } + + foreach ($this->psr4Paths as $namespace => $path) { + $iterator = $this->createFileIterator($path); + // Length of path + separator + $pathLen = strlen($path) + 1; + if ($namespace === '') { + $prefix = ''; + } else { + $prefix = $namespace . '\\'; + } + foreach ($iterator as $file) { + $class = $prefix . str_replace('/', '\\', substr($file, $pathLen, -4)); + if (isset($this->classes[$class])) { + throw new \RuntimeException(sprintf( + 'Ambiguous class %s resolution; defined in %s and in %s.', + $class, + $this->classes[$class][0], + $file, + )); + } + + //FIXME needed? + $mtime = filemtime($file); + + $this->classes[$class] = [$file, $mtime]; + unset($this->missingClasses[$class]); + } + } + + $this->diskScans++; + } + + /** + * Creates an iterator scanning directory for PHP files and subdirectories. + * @throws \RuntimeException if path is not found + */ + private function createFileIterator(string $dir): \Generator { + if (!is_dir($dir)) { + throw new \RuntimeException(sprintf("Directory '%s' not found.", $dir)); + } + + $dir = realpath($dir) ?: $dir; // realpath does not work in phar + $disallow = []; + foreach (array_merge($this->ignoreDirs, $this->excludeDirs) as $item) { + if ($item = realpath($item)) { + $disallow[$item] = true; + } + } + + yield from $this->traverseDir($dir, $disallow); + } + + private function traverseDir(string $dir, array $disallow): \Generator { + try { + $files = new \FilesystemIterator($dir, \FilesystemIterator::FOLLOW_SYMLINKS | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::UNIX_PATHS); + } catch (\RuntimeException) { + return; + } + + foreach ($files as $file) { + $realPath = realpath($file); + $file = $realPath ?: $file; + if ($realPath && isset($disallow[$realPath])) { + continue; + } elseif (is_dir($file) && !self::matches(basename($file), $this->ignoreDirs)) { + yield from $this->traverseDir($file, $disallow); + } elseif (is_file($file) && self::matches(basename($file), $this->acceptFiles)) { + yield $file; + } + } + } + + private static function matches(string $file, array $masks): bool { + foreach ($masks as $mask) { + if (fnmatch($mask, $file)) { + return true; + } + } + return false; + } + + private function updateFile(string $file): void { + foreach ($this->classes as $class => [$prevFile]) { + if ($file === $prevFile) { + unset($this->classes[$class]); + } + } + + $foundClasses = is_file($file) ? $this->scanPhp($file) : []; + + foreach ($foundClasses as $class) { + [$prevFile, $prevMtime] = $this->classes[$class] ?? null; + + if (isset($prevFile) && @filemtime($prevFile) !== $prevMtime) { // @ file may not exist + $this->updateFile($prevFile); + [$prevFile] = $this->classes[$class] ?? null; + } + + if (isset($prevFile)) { + throw new \RuntimeException(sprintf( + 'Ambiguous class %s resolution; defined in %s and in %s.', + $class, + $prevFile, + $file, + )); + } + + $this->classes[$class] = [$file, filemtime($file)]; + } + } + + /** + * Searches classes, interfaces and traits in PHP file. + * @return string[] + */ + private function scanPhp(string $file): array { + $code = file_get_contents($file); + $expected = false; + $namespace = $name = ''; + $level = $minLevel = 0; + $classes = []; + + try { + $tokens = \PhpToken::tokenize($code, TOKEN_PARSE); + } catch (\ParseError $e) { + if ($this->reportParseErrors) { + $rp = new \ReflectionProperty($e, 'file'); + $rp->setAccessible(true); + $rp->setValue($e, $file); + throw $e; + } + + $tokens = []; + } + + foreach ($tokens as $token) { + switch ($token->id) { + case T_COMMENT: + case T_DOC_COMMENT: + case T_WHITESPACE: + continue 2; + + case T_STRING: + case T_NAME_QUALIFIED: + if ($expected) { + $name .= $token->text; + } + + continue 2; + + case T_NAMESPACE: + case T_CLASS: + case T_INTERFACE: + case T_TRAIT: + case PHP_VERSION_ID < 80100 + ? T_CLASS + : T_ENUM: + $expected = $token->id; + $name = ''; + continue 2; + } + + if ($expected) { + if ($expected === T_NAMESPACE) { + $namespace = $name ? $name . '\\' : ''; + $minLevel = $token->text === '{' ? 1 : 0; + + } elseif ($name && $level === $minLevel) { + $classes[] = $namespace . $name; + } + + $expected = null; + } + + if ($token->text === '{') { + $level++; + } elseif ($token->text === '}') { + $level--; + } + } + + return $classes; + } + + /********************* caching ****************d*g**/ + + /** + * Sets auto-refresh mode. + */ + public function setAutoRefresh(bool $on = true): static { + $this->autoRebuild = $on; + return $this; + } + + /** + * Loads class list from cache. + */ + private function loadCache(): void { + if ($this->cacheLoaded) { + return; + } + + $this->cacheLoaded = true; + + $data = $this->dumpCache->loadCache($this->generateCacheKey()); + if (is_array($data)) { + [$this->classes, $this->missingClasses, $this->emptyFiles] = $data; + $this->loadsFromCache++; + return; + } + + $this->classes = $this->missingClasses = $this->emptyFiles = []; + $this->refreshClasses(); + $this->saveCache(); + } + + /** + * Writes class list to cache. + * @param resource $lock + */ + private function saveCache(): void { + $this->dumpCache->saveCache($this->generateCacheKey(), [$this->classes, $this->missingClasses, $this->emptyFiles]); + } + + protected function generateCacheKey(): array { + return [$this->psr4Paths,$this->ignoreDirs, $this->acceptFiles, $this->scanPaths, $this->excludeDirs]; + } + + public function getStats(): array { + return [ + 'Loads from cache' => $this->loadsFromCache, + 'Disk scans' => $this->diskScans, + ]; + } +} diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index e18dcc5ff8ef0..9e0ca1ba0150e 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -125,7 +125,6 @@ public function loadCommands( } } // load from register_command.php - \OC_App::registerAutoloading($app, $appPath); $file = $appPath . '/appinfo/register_command.php'; if (file_exists($file)) { try { diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 5990e93277da3..685c1d3c0a0f8 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -534,7 +534,7 @@ public function installShippedApps(bool $softErrors = false, ?IOutput $output = } private function installAppLastSteps(string $appPath, array $info, ?IOutput $output = null, string $enabled = 'no'): string { - \OC_App::registerAutoloading($info['id'], $appPath); + $this->appManager->registerAutoloading($info['id'], $appPath, true); $previousVersion = $this->config->getAppValue($info['id'], 'installed_version', ''); $ms = new MigrationService($info['id'], Server::get(Connection::class)); diff --git a/lib/private/PhpDumpCache.php b/lib/private/PhpDumpCache.php new file mode 100644 index 0000000000000..dfa1215559935 --- /dev/null +++ b/lib/private/PhpDumpCache.php @@ -0,0 +1,112 @@ +setTempDirectory($tempDirectory); + } + + /** + * Sets path to temporary directory. + */ + public function setTempDirectory(string $dir): static { + if (!is_dir($dir) && !@mkdir($dir, recursive: true) && !is_dir($dir)) { // @ - dir may already exist + throw new \RuntimeException("Unable to create directory '$dir'"); + } + $this->tempDirectory = $dir; + return $this; + } + + /** + * Loads class list from cache. + */ + public function loadCache(array $cacheKey): ?array { + $file = $this->generateCacheFileName($cacheKey); + + // Solving atomicity to work everywhere + // 1) We want to do as little as possible IO calls on production and also directory and file can be not writable (#19) + // so on Linux we include the file directly without shared lock, therefore, the file must be created atomically by renaming. + // 2) On Windows file cannot be renamed-to while is open (ie by include() #11), so we have to acquire a lock. + $lock = defined('PHP_WINDOWS_VERSION_BUILD') + ? $this->acquireLock("$file.lock", LOCK_SH) + : null; + + try { + $data = @include $file; // @ file may not exist + if (is_array($data)) { + return $data; + } + + return null; + } finally { + if ($lock) { + flock($lock, LOCK_UN); // release shared lock + } + } + } + + /** + * Writes class list to cache. + * @param ?resource $lock + */ + public function saveCache(array $cacheKey, array $data, $lock = null): void { + // we have to acquire a lock to be able safely rename file + // on Linux: that another thread does not rename the same named file earlier + // on Windows: that the file is not read by another thread + $file = $this->generateCacheFileName($cacheKey); + $lock = $lock ?: $this->acquireLock("$file.lock", LOCK_EX); + $code = "tempDirectory) { + throw new \LogicException('Set path to temporary directory using setTempDirectory().'); + } + + return $this->tempDirectory . '/' . md5(serialize($cacheKey)) . '.php'; + } +} diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 13e4359fce834..dd1b94fdc5f24 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -110,27 +110,7 @@ public static function loadApp(string $app): void { * @internal */ public static function registerAutoloading(string $app, string $path, bool $force = false): void { - $key = $app . '-' . $path; - if (!$force && isset(self::$alreadyRegistered[$key])) { - return; - } - - self::$alreadyRegistered[$key] = true; - - // Register on PSR-4 composer autoloader - $appNamespace = Server::get(IAppManager::class)->getAppNamespace($app); - \OC::$server->registerNamespace($app, $appNamespace); - - if (file_exists($path . '/composer/autoload.php')) { - require_once $path . '/composer/autoload.php'; - } else { - \OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true); - } - - // Register Test namespace only when testing - if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) { - \OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true); - } + Server::get(IAppManager::class)->registerAutoloading($app, $path, $force); } /** diff --git a/tests/Core/Command/Config/System/CastHelperTest.php b/tests/Core/Command/Config/System/CastHelperTest.php index c47c77ee9f827..d65382ba82b5d 100644 --- a/tests/Core/Command/Config/System/CastHelperTest.php +++ b/tests/Core/Command/Config/System/CastHelperTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Core\Command\Config\System; +namespace Tests\Core\Command\Config\System; use OC\Core\Command\Config\System\CastHelper; use Test\TestCase; diff --git a/tests/Core/Command/Group/AddTest.php b/tests/Core/Command/Group/AddTest.php index fc1406c77a6ba..52186411c5254 100644 --- a/tests/Core/Command/Group/AddTest.php +++ b/tests/Core/Command/Group/AddTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\Group; +namespace Tests\Core\Command\Group; use OC\Core\Command\Group\Add; use OCP\IGroup; diff --git a/tests/Core/Command/Group/AddUserTest.php b/tests/Core/Command/Group/AddUserTest.php index 8d31f7cdbc454..920e2994e3113 100644 --- a/tests/Core/Command/Group/AddUserTest.php +++ b/tests/Core/Command/Group/AddUserTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\Group; +namespace Tests\Core\Command\Group; use OC\Core\Command\Group\AddUser; use OCP\IGroup; diff --git a/tests/Core/Command/Group/DeleteTest.php b/tests/Core/Command/Group/DeleteTest.php index 92315c4daf475..1778ec817b3ed 100644 --- a/tests/Core/Command/Group/DeleteTest.php +++ b/tests/Core/Command/Group/DeleteTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\Group; +namespace Tests\Core\Command\Group; use OC\Core\Command\Group\Delete; use OCP\IGroup; diff --git a/tests/Core/Command/Group/InfoTest.php b/tests/Core/Command/Group/InfoTest.php index 8d9cb1c329181..70df2bd2b4160 100644 --- a/tests/Core/Command/Group/InfoTest.php +++ b/tests/Core/Command/Group/InfoTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\Group; +namespace Tests\Core\Command\Group; use OC\Core\Command\Group\Info; use OCP\IGroup; diff --git a/tests/Core/Command/Group/ListCommandTest.php b/tests/Core/Command/Group/ListCommandTest.php index 2885a6e44b051..99db782ad32c8 100644 --- a/tests/Core/Command/Group/ListCommandTest.php +++ b/tests/Core/Command/Group/ListCommandTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\Group; +namespace Tests\Core\Command\Group; use OC\Core\Command\Group\ListCommand; use OCP\IGroup; diff --git a/tests/Core/Command/Group/RemoveUserTest.php b/tests/Core/Command/Group/RemoveUserTest.php index 0c50152fe1a74..90ba3b3937a16 100644 --- a/tests/Core/Command/Group/RemoveUserTest.php +++ b/tests/Core/Command/Group/RemoveUserTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\Group; +namespace Tests\Core\Command\Group; use OC\Core\Command\Group\RemoveUser; use OCP\IGroup; diff --git a/tests/Core/Command/Preview/CleanupTest.php b/tests/Core/Command/Preview/CleanupTest.php index 6625e792695ca..f00b206ad4c9d 100644 --- a/tests/Core/Command/Preview/CleanupTest.php +++ b/tests/Core/Command/Preview/CleanupTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Core\Command\Preview; +namespace Tests\Core\Command\Preview; use OC\Core\Command\Preview\Cleanup; use OC\Preview\PreviewService; diff --git a/tests/Core/Command/SystemTag/AddTest.php b/tests/Core/Command/SystemTag/AddTest.php index f36bf6c9f14ba..0e4d21eca8bf9 100644 --- a/tests/Core/Command/SystemTag/AddTest.php +++ b/tests/Core/Command/SystemTag/AddTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\SystemTag; +namespace Tests\Core\Command\SystemTag; use OC\Core\Command\SystemTag\Add; use OCP\SystemTag\ISystemTag; diff --git a/tests/Core/Command/SystemTag/DeleteTest.php b/tests/Core/Command/SystemTag/DeleteTest.php index ee53c8b6d3bf7..5ab3a20ab1988 100644 --- a/tests/Core/Command/SystemTag/DeleteTest.php +++ b/tests/Core/Command/SystemTag/DeleteTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\SystemTag; +namespace Tests\Core\Command\SystemTag; use OC\Core\Command\SystemTag\Delete; use OCP\SystemTag\ISystemTagManager; diff --git a/tests/Core/Command/SystemTag/EditTest.php b/tests/Core/Command/SystemTag/EditTest.php index 6e87ff5f3e43b..d554c0c155938 100644 --- a/tests/Core/Command/SystemTag/EditTest.php +++ b/tests/Core/Command/SystemTag/EditTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\SystemTag; +namespace Tests\Core\Command\SystemTag; use OC\Core\Command\SystemTag\Edit; use OCP\SystemTag\ISystemTag; diff --git a/tests/Core/Command/SystemTag/ListCommandTest.php b/tests/Core/Command/SystemTag/ListCommandTest.php index 93f8ca458ad07..623e49133e6c6 100644 --- a/tests/Core/Command/SystemTag/ListCommandTest.php +++ b/tests/Core/Command/SystemTag/ListCommandTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\SystemTag; +namespace Tests\Core\Command\SystemTag; use OC\Core\Command\SystemTag\ListCommand; use OCP\SystemTag\ISystemTag; diff --git a/tests/Core/Command/TwoFactorAuth/CleanupTest.php b/tests/Core/Command/TwoFactorAuth/CleanupTest.php index 33d9a86f2c664..72436e90d391b 100644 --- a/tests/Core/Command/TwoFactorAuth/CleanupTest.php +++ b/tests/Core/Command/TwoFactorAuth/CleanupTest.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Core\Command\TwoFactorAuth; +namespace Tests\Core\Command\TwoFactorAuth; use OC\Core\Command\TwoFactorAuth\Cleanup; use OCP\Authentication\TwoFactorAuth\IRegistry; diff --git a/tests/Core/Command/TwoFactorAuth/DisableTest.php b/tests/Core/Command/TwoFactorAuth/DisableTest.php index ab5c3dd365bd9..4663d3785f7c6 100644 --- a/tests/Core/Command/TwoFactorAuth/DisableTest.php +++ b/tests/Core/Command/TwoFactorAuth/DisableTest.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\TwoFactorAuth; +namespace Tests\Core\Command\TwoFactorAuth; use OC\Authentication\TwoFactorAuth\ProviderManager; use OC\Core\Command\TwoFactorAuth\Disable; diff --git a/tests/Core/Command/TwoFactorAuth/EnableTest.php b/tests/Core/Command/TwoFactorAuth/EnableTest.php index 320782c039fc6..90859ffe1323b 100644 --- a/tests/Core/Command/TwoFactorAuth/EnableTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnableTest.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Command\TwoFactorAuth; +namespace Tests\Core\Command\TwoFactorAuth; use OC\Authentication\TwoFactorAuth\ProviderManager; use OC\Core\Command\TwoFactorAuth\Enable; diff --git a/tests/Core/Command/TwoFactorAuth/StateTest.php b/tests/Core/Command/TwoFactorAuth/StateTest.php index da18a405478fa..cb1dff02ec0cc 100644 --- a/tests/Core/Command/TwoFactorAuth/StateTest.php +++ b/tests/Core/Command/TwoFactorAuth/StateTest.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Core\Command\TwoFactorAuth; +namespace Tests\Core\Command\TwoFactorAuth; use OC\Core\Command\TwoFactorAuth\State; use OCP\Authentication\TwoFactorAuth\IRegistry; diff --git a/tests/Core/Command/User/AddTest.php b/tests/Core/Command/User/AddTest.php index 98d11b0214c11..31fc7d96d9794 100644 --- a/tests/Core/Command/User/AddTest.php +++ b/tests/Core/Command/User/AddTest.php @@ -7,7 +7,7 @@ declare(strict_types=1); -namespace Core\Command\User; +namespace Tests\Core\Command\User; use OC\Core\Command\User\Add; use OCA\Settings\Mailer\NewUserMailHelper; diff --git a/tests/Core/Command/User/ProfileTest.php b/tests/Core/Command/User/ProfileTest.php index 5ebbd9182a3a2..d967fc0b1281e 100644 --- a/tests/Core/Command/User/ProfileTest.php +++ b/tests/Core/Command/User/ProfileTest.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Core\Command\User; +namespace Tests\Core\Command\User; use OC\Core\Command\User\Profile; use OCP\Accounts\IAccount; diff --git a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php index d20dde5fe29a8..6a2a27b7cee13 100644 --- a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Controller; +namespace Tests\Core\Controller; use OC\Core\Controller\ClientFlowLoginV2Controller; use OC\Core\Data\LoginFlowV2Credentials; diff --git a/tests/Core/Controller/ContactsMenuControllerTest.php b/tests/Core/Controller/ContactsMenuControllerTest.php index c06086bce24c4..0f8bc3814f977 100644 --- a/tests/Core/Controller/ContactsMenuControllerTest.php +++ b/tests/Core/Controller/ContactsMenuControllerTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Tests\Controller; +namespace Tests\Core\Controller; use OC\Contacts\ContactsMenu\Manager; use OC\Core\Controller\ContactsMenuController; diff --git a/tests/Core/Controller/GuestAvatarControllerTest.php b/tests/Core/Controller/GuestAvatarControllerTest.php index 0626f0198fdaf..6c83ffbe40981 100644 --- a/tests/Core/Controller/GuestAvatarControllerTest.php +++ b/tests/Core/Controller/GuestAvatarControllerTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Core\Controller; +namespace Tests\Core\Controller; use OC\Core\Controller\GuestAvatarController; use OCP\AppFramework\Http\FileDisplayResponse; diff --git a/tests/Core/Controller/OCSControllerTest.php b/tests/Core/Controller/OCSControllerTest.php index fac18e344920c..cd87fa458df21 100644 --- a/tests/Core/Controller/OCSControllerTest.php +++ b/tests/Core/Controller/OCSControllerTest.php @@ -6,9 +6,10 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OC\Core\Controller; +namespace Tests\Core\Controller; use OC\CapabilitiesManager; +use OC\Core\Controller\OCSController; use OC\Security\IdentityProof\Key; use OC\Security\IdentityProof\Manager; use OCP\AppFramework\Http\DataResponse; diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php index 2d47f7d651954..a7492be300f22 100644 --- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php +++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Test\Core\Controller; +namespace Tests\Core\Controller; use OC\Authentication\TwoFactorAuth\Manager; use OC\Authentication\TwoFactorAuth\ProviderSet; diff --git a/tests/Core/Controller/UserControllerTest.php b/tests/Core/Controller/UserControllerTest.php index 4f0380f6b96d8..90aca5c7ab78d 100644 --- a/tests/Core/Controller/UserControllerTest.php +++ b/tests/Core/Controller/UserControllerTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\Core\Controller; +namespace Tests\Core\Controller; use OC\Core\Controller\UserController; use OCP\AppFramework\Http\JSONResponse; diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php index 46b4afaff0a44..6fb53ea174447 100644 --- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php +++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Test\Core\Middleware; +namespace Tests\Core\Middleware; use OC\AppFramework\Http\Attributes\TwoFactorSetUpDoneRequired; use OC\AppFramework\Http\Request; diff --git a/tests/autoload.php b/tests/autoload.php index 05fc38529242f..c25319e45f381 100644 --- a/tests/autoload.php +++ b/tests/autoload.php @@ -13,4 +13,5 @@ * This is a file that applications can require to be able to autoload the class Test\TestCase from Nextcloud tests */ -\OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/', true); +\OC::$autoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/'); +\OC::$autoloader->triggerReload(); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 1fb54344d4978..8db9c6fca81cc 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -21,7 +21,7 @@ require_once __DIR__ . '/../lib/base.php'; require_once __DIR__ . '/autoload.php'; -\OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/', true); +\OC::$autoloader->addPsr4('Tests\\Core', OC::$SERVERROOT . '/tests/Core'); $dontLoadApps = getenv('TEST_DONT_LOAD_APPS'); if (!$dontLoadApps) { diff --git a/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php b/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php index f1d38c10801c1..0b8da3bfd1eeb 100644 --- a/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php @@ -12,7 +12,7 @@ * Time: 13:01 */ -namespace Tests\Authentication\TwoFactorAuth; +namespace Test\Authentication\TwoFactorAuth; use OC\Authentication\TwoFactorAuth\EnforcementState; use Test\TestCase; diff --git a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php index cfbb701414c93..5b24a4a25b1b9 100644 --- a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Tests\Authentication\TwoFactorAuth; +namespace Test\Authentication\TwoFactorAuth; use OC\Authentication\TwoFactorAuth\EnforcementState; use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor; diff --git a/tests/lib/Config/LexiconTest.php b/tests/lib/Config/LexiconTest.php index c3ead6240b5f4..83ec9ca207482 100644 --- a/tests/lib/Config/LexiconTest.php +++ b/tests/lib/Config/LexiconTest.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Tests\lib\Config; +namespace Test\Config; use OC\AppConfig; use OC\AppFramework\Bootstrap\Coordinator; diff --git a/tests/lib/Config/TestConfigLexicon_I.php b/tests/lib/Config/TestConfigLexicon_I.php index a7fb9e6d568ff..390157418250d 100644 --- a/tests/lib/Config/TestConfigLexicon_I.php +++ b/tests/lib/Config/TestConfigLexicon_I.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Tests\lib\Config; +namespace Test\Config; use OCP\Config\IUserConfig; use OCP\Config\Lexicon\Entry; diff --git a/tests/lib/Config/TestLexicon_E.php b/tests/lib/Config/TestLexicon_E.php index b3992e72d8e73..62deb8c742e3a 100644 --- a/tests/lib/Config/TestLexicon_E.php +++ b/tests/lib/Config/TestLexicon_E.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Tests\lib\Config; +namespace Test\Config; use OCP\Config\IUserConfig; use OCP\Config\Lexicon\Entry; diff --git a/tests/lib/Config/TestLexicon_N.php b/tests/lib/Config/TestLexicon_N.php index aee68db5032a7..1ce4eac3550e9 100644 --- a/tests/lib/Config/TestLexicon_N.php +++ b/tests/lib/Config/TestLexicon_N.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Tests\lib\Config; +namespace Test\Config; use OCP\Config\IUserConfig; use OCP\Config\Lexicon\Entry; diff --git a/tests/lib/Config/TestLexicon_UserIndexed.php b/tests/lib/Config/TestLexicon_UserIndexed.php index e876b834585f8..7b4ea3c0e2999 100644 --- a/tests/lib/Config/TestLexicon_UserIndexed.php +++ b/tests/lib/Config/TestLexicon_UserIndexed.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Tests\lib\Config; +namespace Test\Config; use OCP\Config\IUserConfig; use OCP\Config\Lexicon\Entry; diff --git a/tests/lib/Config/TestLexicon_UserIndexedRemove.php b/tests/lib/Config/TestLexicon_UserIndexedRemove.php index 5cb326d364625..b4a163ed164b9 100644 --- a/tests/lib/Config/TestLexicon_UserIndexedRemove.php +++ b/tests/lib/Config/TestLexicon_UserIndexedRemove.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Tests\lib\Config; +namespace Test\Config; use OCP\Config\Lexicon\Entry; use OCP\Config\Lexicon\ILexicon; diff --git a/tests/lib/Config/TestLexicon_W.php b/tests/lib/Config/TestLexicon_W.php index f945bd4bba510..c420cc85ad488 100644 --- a/tests/lib/Config/TestLexicon_W.php +++ b/tests/lib/Config/TestLexicon_W.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Tests\lib\Config; +namespace Test\Config; use OCP\Config\IUserConfig; use OCP\Config\Lexicon\Entry; diff --git a/tests/lib/Config/UserConfigMigrationFallbackTest.php b/tests/lib/Config/UserConfigMigrationFallbackTest.php index c31c547bd5e4b..927e8a86275a0 100644 --- a/tests/lib/Config/UserConfigMigrationFallbackTest.php +++ b/tests/lib/Config/UserConfigMigrationFallbackTest.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Test\lib\Config; +namespace Test\Config; use Doctrine\DBAL\Exception\InvalidFieldNameException; use OC\Config\ConfigManager; diff --git a/tests/lib/Config/UserConfigTest.php b/tests/lib/Config/UserConfigTest.php index 5ac90a02a3d5f..816eaae6dead6 100644 --- a/tests/lib/Config/UserConfigTest.php +++ b/tests/lib/Config/UserConfigTest.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -namespace Test\lib\Config; +namespace Test\Config; use OC\Config\ConfigManager; use OC\Config\PresetManager; diff --git a/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php b/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php index 8b939928d8609..0a0754bea1000 100644 --- a/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php +++ b/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Tests\Contacts\ContactsMenu; +namespace Test\Contacts\ContactsMenu; use OC\Contacts\ContactsMenu\ActionFactory; use OCP\Contacts\ContactsMenu\IAction; diff --git a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php index 08afc6e930786..dfa03a003a82b 100644 --- a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php +++ b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Tests\Contacts\ContactsMenu; +namespace Test\Contacts\ContactsMenu; use OC\App\AppManager; use OC\Contacts\ContactsMenu\ActionProviderStore; diff --git a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php index b2a9ecb362fb6..f0d11a44a11f9 100644 --- a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php +++ b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Tests\Contacts\ContactsMenu\Actions; +namespace Test\Contacts\ContactsMenu\Actions; use OC\Contacts\ContactsMenu\Actions\LinkAction; use Test\TestCase; diff --git a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php index f8faa2b17f966..645167c28d293 100644 --- a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php +++ b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Tests\Contacts\ContactsMenu; +namespace Test\Contacts\ContactsMenu; use OC\Contacts\ContactsMenu\ContactsStore; use OC\KnownUser\KnownUserService; diff --git a/tests/lib/Contacts/ContactsMenu/EntryTest.php b/tests/lib/Contacts/ContactsMenu/EntryTest.php index c0f07f7bf3b00..8f38469d38416 100644 --- a/tests/lib/Contacts/ContactsMenu/EntryTest.php +++ b/tests/lib/Contacts/ContactsMenu/EntryTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Tests\Contacts\ContactsMenu; +namespace Test\Contacts\ContactsMenu; use OC\Contacts\ContactsMenu\Actions\LinkAction; use OC\Contacts\ContactsMenu\Entry; diff --git a/tests/lib/Contacts/ContactsMenu/ManagerTest.php b/tests/lib/Contacts/ContactsMenu/ManagerTest.php index dfa37dd926ec5..0d66cea061860 100644 --- a/tests/lib/Contacts/ContactsMenu/ManagerTest.php +++ b/tests/lib/Contacts/ContactsMenu/ManagerTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Tests\Contacts\ContactsMenu; +namespace Test\Contacts\ContactsMenu; use OC\Contacts\ContactsMenu\ActionProviderStore; use OC\Contacts\ContactsMenu\ContactsStore; diff --git a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php index 36ce0b96540f3..59cd08e7fa706 100644 --- a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php +++ b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php @@ -5,7 +5,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Tests\Contacts\ContactsMenu\Providers; +namespace Test\Contacts\ContactsMenu\Providers; use OC\Contacts\ContactsMenu\Providers\EMailProvider; use OCP\Contacts\ContactsMenu\IActionFactory; diff --git a/tests/lib/Http/WellKnown/GenericResponseTest.php b/tests/lib/Http/WellKnown/GenericResponseTest.php index f35f43221b8ce..2e74569a43469 100644 --- a/tests/lib/Http/WellKnown/GenericResponseTest.php +++ b/tests/lib/Http/WellKnown/GenericResponseTest.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace Tests\Http\WellKnown; +namespace Test\Http\WellKnown; use OCP\AppFramework\Http\JSONResponse; use OCP\Http\WellKnown\GenericResponse;