/** * @test */ public function getArgumentDefinitionsReturnsArrayOfArgumentDefinitionIfCommandExpectsArguments() { $parameterReflection = $this->createMock(\TYPO3\Flow\Reflection\ParameterReflection::class, array(), array(array(__CLASS__, 'dummyMethod'), 'arg')); $mockReflectionService = $this->createMock(\TYPO3\Flow\Reflection\ReflectionService::class); $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->methodReflection->expects($this->atLeastOnce())->method('getParameters')->will($this->returnValue(array($parameterReflection))); $this->methodReflection->expects($this->atLeastOnce())->method('getTagsValues')->will($this->returnValue(array('param' => array('@param $argument1 argument1 description', '@param $argument2 argument2 description')))); $expectedResult = array(new \TYPO3\Flow\Cli\CommandArgumentDefinition('argument1', true, 'argument1 description'), new \TYPO3\Flow\Cli\CommandArgumentDefinition('argument2', false, 'argument2 description')); $actualResult = $this->command->getArgumentDefinitions(); $this->assertEquals($expectedResult, $actualResult); }