/** * @test */ public function getAvailableCommandsReturnsAllAvailableCommands() { $commandManager = new CommandManager(); $commandManager->injectReflectionService($this->mockReflectionService); $mockCommandControllerClassNames = array('TYPO3\\FLOW3\\Tests\\Unit\\Cli\\Fixtures\\Command\\MockACommandController', 'TYPO3\\FLOW3\\Tests\\Unit\\Cli\\Fixtures\\Command\\MockBCommandController'); $this->mockReflectionService->expects($this->once())->method('getAllSubClassNamesForClass')->with('TYPO3\\FLOW3\\Cli\\CommandController')->will($this->returnValue($mockCommandControllerClassNames)); $commands = $commandManager->getAvailableCommands(); $this->assertEquals(3, count($commands)); $this->assertEquals('typo3.flow3.tests.unit.cli.fixtures:mocka:foo', $commands[0]->getCommandIdentifier()); $this->assertEquals('typo3.flow3.tests.unit.cli.fixtures:mocka:bar', $commands[1]->getCommandIdentifier()); $this->assertEquals('typo3.flow3.tests.unit.cli.fixtures:mockb:baz', $commands[2]->getCommandIdentifier()); }