/** * @test */ public function getAvailableCommandsReturnsAllAvailableCommands() { $commandManager = new CommandManager(); $mockCommandControllerClassNames = array(Fixtures\Command\MockACommandController::class, Fixtures\Command\MockBCommandController::class); $this->mockReflectionService->expects($this->once())->method('getAllSubClassNamesForClass')->with(Cli\CommandController::class)->will($this->returnValue($mockCommandControllerClassNames)); $mockObjectManager = $this->createMock(ObjectManagerInterface::class); $mockObjectManager->expects($this->any())->method('get')->with(ReflectionService::class)->willReturn($this->mockReflectionService); $commandManager->injectObjectManager($mockObjectManager); $commands = $commandManager->getAvailableCommands(); $this->assertEquals(3, count($commands)); $this->assertEquals('neos.flow.tests.unit.cli.fixtures:mocka:foo', $commands[0]->getCommandIdentifier()); $this->assertEquals('neos.flow.tests.unit.cli.fixtures:mocka:bar', $commands[1]->getCommandIdentifier()); $this->assertEquals('neos.flow.tests.unit.cli.fixtures:mockb:baz', $commands[2]->getCommandIdentifier()); }