/** * @test * @author Robert Lemke <*****@*****.**> */ 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('Tx_SomeExtensionName_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('some_extension_name:default:list --b2 y --b1 1 --b3 true --b4 false --b5 n --b6 0'); $this->assertEquals($expectedArguments, $request->getArguments()); }
public function getClient() { if ($this->client == null) { if ($this->request == null) { throw new NoRequestException(); } if (!$this->request->headers->has('X-StorageApi-Token')) { throw new UserException('Missing StorageAPI token'); } if ($this->request->headers->has('X-StorageApi-Url')) { $this->storageApiUrl = $this->request->headers->get('X-StorageApi-Url'); } $this->stub->__construct(['token' => $this->request->headers->get('X-StorageApi-Token'), 'url' => $this->storageApiUrl, 'userAgent' => explode('/', $this->request->getPathInfo())[1]]); $this->client = $this->stub; if ($this->request->headers->has('X-KBC-RunId')) { $kbcRunId = $this->client->generateRunId($this->request->headers->get('X-KBC-RunId')); } else { $kbcRunId = $this->client->generateRunId(); } $this->client->setRunId($kbcRunId); } return $this->client; }