Esempio n. 1
0
 /**
  * @test
  */
 public function getArgumentDefinitionsReturnsArrayOfArgumentDefinitionIfCommandExpectsArguments()
 {
     $mockParameterReflection = $this->getMock('TYPO3\\FLOW3\\Reflection\\ParameterReflection', array(), array(), '', FALSE);
     $mockReflectionService = $this->getMock('TYPO3\\FLOW3\\Reflection\\ReflectionService');
     $mockMethodParameters = array('argument1' => array('optional' => FALSE), 'argument2' => array('optional' => TRUE));
     $mockReflectionService->expects($this->atLeastOnce())->method('getMethodParameters')->will($this->returnValue($mockMethodParameters));
     $this->command->injectReflectionService($mockReflectionService);
     $this->mockMethodReflection->expects($this->atLeastOnce())->method('getParameters')->will($this->returnValue(array($mockParameterReflection)));
     $this->mockMethodReflection->expects($this->atLeastOnce())->method('getTagsValues')->will($this->returnValue(array('param' => array('@param $argument1 argument1 description', '@param $argument2 argument2 description'))));
     $expectedResult = array(new \TYPO3\FLOW3\Cli\CommandArgumentDefinition('argument1', TRUE, 'argument1 description'), new \TYPO3\FLOW3\Cli\CommandArgumentDefinition('argument2', FALSE, 'argument2 description'));
     $actualResult = $this->command->getArgumentDefinitions();
     $this->assertEquals($expectedResult, $actualResult);
 }