collect('module:gnuboard7-hello_module'); // api.php 의 공개 memos GET 2건(index/show)이 폴백으로 수집된다. $this->assertNotEmpty($routes, '미설치 모듈의 번들 라우트가 폴백으로 수집되어야 한다'); $names = array_column($routes, 'name'); $this->assertContains('api.modules.gnuboard7-hello_module.memos.index', $names); $this->assertContains('api.modules.gnuboard7-hello_module.memos.show', $names); } #[Test] public function 폴백_수집_라우트는_프로바이더와_동일한_ur_l_규약을_따른다(): void { $routes = app(ApiRouteInventory::class)->collect('module:gnuboard7-hello_module'); $index = collect($routes)->firstWhere('name', 'api.modules.gnuboard7-hello_module.memos.index'); $this->assertNotNull($index); $this->assertSame('GET', $index['method']); $this->assertSame('/api/modules/gnuboard7-hello_module/memos', $index['uri']); $this->assertSame('module', $index['owner']['type']); $this->assertSame('gnuboard7-hello_module', $index['owner']['id']); $this->assertSame('memos', $index['domain_group']); $this->assertSame( 'Modules\\Gnuboard7\\HelloModule\\Http\\Controllers\\Api\\MemoController', $index['controller'] ); } #[Test] public function web_admin_라우트는_ap_i_문서_대상에서_제외된다(): void { // 확장 web 라우트 중 PG 콜백·웹훅은 문서 대상이지만(machine-facing), hello_module 의 // admin CRUD 는 사람이 브라우저로 여는 관리자 화면(web.modules.{id}.admin.*)이라 제외된다. // hello_module 의 web.php 는 admin 화면뿐이므로 결과적으로 api/ 라우트만 남는다. $routes = app(ApiRouteInventory::class)->collect('module:gnuboard7-hello_module'); foreach ($routes as $route) { $this->assertStringStartsWith('/api/', $route['uri']); } $names = array_column($routes, 'name'); $this->assertNotContains('api.modules.gnuboard7-hello_module.admin.memos.store', $names); $this->assertNotContains('web.modules.gnuboard7-hello_module.admin.memos.store', $names); } #[Test] public function 라우트_파일이_없는_범위는_빈_배열을_반환한다(): void { $routes = app(ApiRouteInventory::class)->collect('module:nonexistent-module-xyz'); $this->assertSame([], $routes); } }