container = new DefaultContainer(); $this->output = new ConsoleOutput(); $this->discoveryRegistry = new DiscoveryRegistry( attributes: new AttributeRegistry(), interfaces: new InterfaceRegistry([]), templates: new TemplateRegistry([]) ); $this->state = new TuiState(); $this->renderer = new TuiRenderer($this->output, $this->state); $this->commandExecutor = new TuiCommandExecutor( new \App\Framework\Console\CommandRegistry($this->container, $this->discoveryRegistry), $this->container, $this->discoveryRegistry, new CommandHistory(), new \App\Framework\Console\CommandValidator(), new \App\Framework\Console\CommandHelpGenerator(new \App\Framework\Console\ParameterInspector()), 'test-console' ); $this->commandHistory = new CommandHistory(); $this->groupRegistry = new CommandGroupRegistry($this->discoveryRegistry); $this->workflowExecutor = new SimpleWorkflowExecutor($this->container, $this->discoveryRegistry); }); it('can be instantiated', function () { $tui = new ConsoleTUI( $this->output, $this->container, $this->discoveryRegistry, $this->state, $this->renderer, $this->commandExecutor, $this->commandHistory, $this->groupRegistry, $this->workflowExecutor ); expect($tui)->toBeInstanceOf(ConsoleTUI::class); }); it('has run method', function () { $tui = new ConsoleTUI( $this->output, $this->container, $this->discoveryRegistry, $this->state, $this->renderer, $this->commandExecutor, $this->commandHistory, $this->groupRegistry, $this->workflowExecutor ); expect(method_exists($tui, 'run'))->toBeTrue(); }); it('has handleShutdownSignal method', function () { $tui = new ConsoleTUI( $this->output, $this->container, $this->discoveryRegistry, $this->state, $this->renderer, $this->commandExecutor, $this->commandHistory, $this->groupRegistry, $this->workflowExecutor ); expect(method_exists($tui, 'handleShutdownSignal'))->toBeTrue(); }); it('has handleShutdownSignalLegacy method', function () { $tui = new ConsoleTUI( $this->output, $this->container, $this->discoveryRegistry, $this->state, $this->renderer, $this->commandExecutor, $this->commandHistory, $this->groupRegistry, $this->workflowExecutor ); expect(method_exists($tui, 'handleShutdownSignalLegacy'))->toBeTrue(); }); it('initializes with all required dependencies', function () { $tui = new ConsoleTUI( $this->output, $this->container, $this->discoveryRegistry, $this->state, $this->renderer, $this->commandExecutor, $this->commandHistory, $this->groupRegistry, $this->workflowExecutor ); expect($tui)->toBeInstanceOf(ConsoleTUI::class); }); }); describe('ConsoleTUI Terminal Compatibility', function () { beforeEach(function () { $this->container = new DefaultContainer(); $this->output = new ConsoleOutput(); $this->discoveryRegistry = new DiscoveryRegistry( attributes: new AttributeRegistry(), interfaces: new InterfaceRegistry([]), templates: new TemplateRegistry([]) ); $this->state = new TuiState(); $this->renderer = new TuiRenderer($this->output, $this->state); $this->commandExecutor = new TuiCommandExecutor( new \App\Framework\Console\CommandRegistry($this->container, $this->discoveryRegistry), $this->container, $this->discoveryRegistry, new CommandHistory(), new \App\Framework\Console\CommandValidator(), new \App\Framework\Console\CommandHelpGenerator(new \App\Framework\Console\ParameterInspector()), 'test-console' ); $this->commandHistory = new CommandHistory(); $this->groupRegistry = new CommandGroupRegistry($this->discoveryRegistry); $this->workflowExecutor = new SimpleWorkflowExecutor($this->container, $this->discoveryRegistry); }); it('handles terminal compatibility check', function () { $tui = new ConsoleTUI( $this->output, $this->container, $this->discoveryRegistry, $this->state, $this->renderer, $this->commandExecutor, $this->commandHistory, $this->groupRegistry, $this->workflowExecutor ); // TUI should handle terminal compatibility internally expect($tui)->toBeInstanceOf(ConsoleTUI::class); }); });