/**
  * Sets up this test case
  *
  * @author Robert Lemke <*****@*****.**>
  */
 protected function setUp()
 {
     $this->request = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class, array('dummy'));
     $this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
     $this->mockObjectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class)->will($this->returnValue($this->request));
     $this->mockCommand = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array(), array(), '', FALSE);
     $this->mockCommand->expects($this->any())->method('getControllerClassName')->will($this->returnValue('Tx_SomeExtensionName_Command_DefaultCommandController'));
     $this->mockCommand->expects($this->any())->method('getControllerCommandName')->will($this->returnValue('list'));
     $this->mockCommandManager = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class);
     $this->mockCommandManager->expects($this->any())->method('getCommandByIdentifier')->with('some_extension_name:default:list')->will($this->returnValue($this->mockCommand));
     $this->mockReflectionService = $this->getMock(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
     $this->mockConfigurationManager = $this->getMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
     $this->requestBuilder = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::class, array('dummy'));
     $this->requestBuilder->_set('objectManager', $this->mockObjectManager);
     $this->requestBuilder->_set('reflectionService', $this->mockReflectionService);
     $this->requestBuilder->_set('commandManager', $this->mockCommandManager);
     $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
 }
 /**
  * @test
  * @expectedException \TYPO3\CMS\Extbase\Mvc\Exception\AmbiguousCommandIdentifierException
  * @author Bastian Waidelich <*****@*****.**>
  */
 public function getCommandByIdentifierThrowsExceptionIfMoreThanOneMatchingCommandWasFound()
 {
     $mockCommand1 = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array(), array(), '', FALSE);
     $mockCommand1->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('extensionkey:controller:command'));
     $mockCommand2 = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array(), array(), '', FALSE);
     $mockCommand2->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('otherextensionkey:controller:command'));
     $mockCommands = array($mockCommand1, $mockCommand2);
     $this->commandManager->expects($this->once())->method('getAvailableCommands')->will($this->returnValue($mockCommands));
     $this->commandManager->getCommandByIdentifier('controller:command');
 }