getContainer()->get(PQueueWorkerRunCommand::class); $application->add($command); $commandTester = new CommandTester($application->find('pqueue:worker:run')); $exitCode = $commandTester->execute([ '--stop-when-empty' => true, '--memory-limit' => '64' ]); $this->assertSame(0, $exitCode, 'Command should return success code 0'); $display = trim($commandTester->getDisplay()); $display = preg_replace('/\e\[[0-9;]*m/', '', $display); $this->assertStringContainsStringIgnoringCase( 'Worker started.', $display ); $optionsDisplay = [ 'Stop when empty : Yes', ' Idle sleep : 10 s', ' Retry delay : 60 s' ]; foreach ($optionsDisplay as $expectedLine) { $this->assertStringContainsString($expectedLine, $display, "Expected line '{$expectedLine}' not found in command output."); } } }