config->set([ 'default' => 'file', 'stores' => [ 'file' => ['type' => 'File', 'path' => sys_get_temp_dir() . '/thinkadmin-helper-menu-cache'], ], ], 'cache'); } public function testItReadsSystemPluginMenuMetadata(): void { $menus = PluginMenuService::menus(Service::class); $root = PluginMenuService::menuRoot(Service::class); $exists = PluginMenuService::menuExists(Service::class); $this->assertNotEmpty($menus); $this->assertSame('系统管理', $root['name'] ?? ''); $this->assertSame('system/config/index', $exists['url|node'] ?? ''); } public function testItValidatesSystemPluginMenusAgainstControllerAnnotations(): void { PluginMenuService::assertMenus(Service::class); $this->addToAssertionCount(1); } public function testItRejectsUnknownServiceClass(): void { $this->expectException(Exception::class); PluginMenuService::menus('plugin\system\tests\helper\MissingService'); } }