*/ public static function installFlows(): array { return [ 'plugin' => [PluginManager::class, 'installPlugin', 'copyFromPendingOrBundled($pluginName', "registerExtensionAutoloadPaths('plugins', \$pluginName)", 'reloadPlugin($pluginName)'], 'module' => [ModuleManager::class, 'installModule', 'copyFromPendingOrBundled($moduleName', "registerExtensionAutoloadPaths('modules', \$moduleName)", 'reloadModule($moduleName)'], ]; } /** * @dataProvider installFlows */ public function test_autoload_paths_are_registered_between_copy_and_entry_file_load( string $class, string $method, string $copyCall, string $registerCall, string $reloadCall, ): void { $ref = new \ReflectionMethod($class, $method); $lines = file($ref->getFileName()); $body = implode('', array_slice($lines, $ref->getStartLine() - 1, $ref->getEndLine() - $ref->getStartLine() + 1)); $copyPos = strpos($body, $copyCall); $registerPos = strpos($body, $registerCall); $reloadPos = strpos($body, $reloadCall); $this->assertNotFalse($copyPos, "{$class}::{$method} 에 복사 호출이 없습니다"); $this->assertNotFalse($registerPos, "{$class}::{$method} 가 진입 파일 로드 전에 PSR-4 매핑을 등록하지 않습니다"); $this->assertNotFalse($reloadPos, "{$class}::{$method} 에 재로드 호출이 없습니다"); $this->assertGreaterThan($copyPos, $registerPos, '오토로드 등록은 활성 디렉토리 복사 뒤에 와야 합니다 (그 전에는 composer.json 이 없다)'); $this->assertLessThan($reloadPos, $registerPos, '오토로드 등록은 진입 파일 로드(reload) 앞에 와야 합니다'); } }