/** * @test * @dataProvider quotedValues */ public function quotedArgumentValuesAreCorrectlyParsedWhenPassingTheCommandAsString($quotedArgument, $expectedResult) { $methodParameters = array('requiredArgument1' => array('optional' => FALSE, 'type' => 'string'), 'requiredArgument2' => array('optional' => FALSE, 'type' => 'string')); $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Acme\\Test\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters)); $expectedArguments = array('requiredArgument1' => 'firstArgumentValue', 'requiredArgument2' => $expectedResult); $request = $this->requestBuilder->build('acme.test:default:list firstArgumentValue ' . $quotedArgument); $this->assertEquals($expectedArguments, $request->getArguments()); }
/** * @test */ public function booleanOptionsCanHaveOnlyCertainValuesIfTheValueIsAssignedWithoutEqualSign() { $methodParameters = array('b1' => array('optional' => TRUE, 'type' => 'boolean'), 'b2' => array('optional' => TRUE, 'type' => 'boolean'), 'b3' => array('optional' => TRUE, 'type' => 'boolean'), 'b4' => array('optional' => TRUE, 'type' => 'boolean'), 'b5' => array('optional' => TRUE, 'type' => 'boolean'), 'b6' => array('optional' => TRUE, 'type' => 'boolean')); $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Acme\\Test\\Command\\DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters)); $expectedArguments = array('b1' => TRUE, 'b2' => TRUE, 'b3' => TRUE, 'b4' => FALSE, 'b5' => FALSE, 'b6' => FALSE); $request = $this->requestBuilder->build('acme.test:default:list --b2 y --b1 1 --b3 true --b4 false --b5 n --b6 0'); $this->assertEquals($expectedArguments, $request->getArguments()); }