'/test', 'method' => Method::GET], additionalData: [] ); $attributes->add(Route::class, $routeAttribute); $registry = new DiscoveryRegistry( attributes: $attributes, interfaces: new InterfaceRegistry(), templates: new TemplateRegistry() ); expect($registry->hasRoutes())->toBeTrue(); expect($registry->hasCommands())->toBeFalse(); expect($registry->hasInitializers())->toBeFalse(); expect($registry->hasContent())->toBeTrue(); }); it('hasCommands returns true when commands are present', function () { $attributes = new AttributeRegistry(); $commandAttribute = new DiscoveredAttribute( className: ClassName::create('App\\Test\\Command'), attributeClass: ConsoleCommand::class, target: AttributeTarget::METHOD, methodName: MethodName::create('handle'), arguments: ['name' => 'test:command'], additionalData: [] ); $attributes->add(ConsoleCommand::class, $commandAttribute); $registry = new DiscoveryRegistry( attributes: $attributes, interfaces: new InterfaceRegistry(), templates: new TemplateRegistry() ); expect($registry->hasRoutes())->toBeFalse(); expect($registry->hasCommands())->toBeTrue(); expect($registry->hasInitializers())->toBeFalse(); expect($registry->hasContent())->toBeTrue(); }); it('hasInitializers returns true when initializers are present', function () { $attributes = new AttributeRegistry(); $initializerAttribute = new DiscoveredAttribute( className: ClassName::create('App\\Test\\Initializer'), attributeClass: Initializer::class, target: AttributeTarget::METHOD, methodName: MethodName::create('initialize'), arguments: [], additionalData: [] ); $attributes->add(Initializer::class, $initializerAttribute); $registry = new DiscoveryRegistry( attributes: $attributes, interfaces: new InterfaceRegistry(), templates: new TemplateRegistry() ); expect($registry->hasRoutes())->toBeFalse(); expect($registry->hasCommands())->toBeFalse(); expect($registry->hasInitializers())->toBeTrue(); expect($registry->hasContent())->toBeTrue(); }); it('hasContent returns false when registry is empty', function () { $registry = DiscoveryRegistry::empty(); expect($registry->hasRoutes())->toBeFalse(); expect($registry->hasCommands())->toBeFalse(); expect($registry->hasInitializers())->toBeFalse(); expect($registry->hasContent())->toBeFalse(); }); it('getContentSummary returns correct counts', function () { $attributes = new AttributeRegistry(); // Add route $routeAttribute = new DiscoveredAttribute( className: ClassName::create('App\\Test\\Controller'), attributeClass: Route::class, target: AttributeTarget::METHOD, methodName: MethodName::create('index'), arguments: ['path' => '/test', 'method' => Method::GET], additionalData: [] ); $attributes->add(Route::class, $routeAttribute); // Add command $commandAttribute = new DiscoveredAttribute( className: ClassName::create('App\\Test\\Command'), attributeClass: ConsoleCommand::class, target: AttributeTarget::METHOD, methodName: MethodName::create('handle'), arguments: ['name' => 'test:command'], additionalData: [] ); $attributes->add(ConsoleCommand::class, $commandAttribute); $registry = new DiscoveryRegistry( attributes: $attributes, interfaces: new InterfaceRegistry(), templates: new TemplateRegistry() ); $summary = $registry->getContentSummary(); expect($summary)->toBeArray(); expect($summary['routes'])->toBe(1); expect($summary['commands'])->toBe(1); expect($summary['initializers'])->toBe(0); expect($summary['interfaces'])->toBe(0); expect($summary['templates'])->toBe(0); }); });