function it_performs_request_without_validation(MethodInterface $method, ClientInterface $client, ResultObjectMapperInterface $mapper) { $result = ['amount' => 50.0]; $resultObject = new Payment(); $method->getMethod()->willReturn('GET'); $method->getAction()->willReturn('payment'); $method->getAttributes()->willReturn(['field' => 'value']); $method->createResultObject()->willReturn($resultObject); $mapper->map($result, $resultObject)->shouldBeCalled()->willReturn($resultObject); $client->sendRequest($method, 'GET', 'payment', ['query' => ['field' => 'value']])->shouldBeCalled()->willReturn($result); $this->callNoValidate($method)->shouldReturn($resultObject); }
/** * Prepare request options for particular method * @param MethodInterface $method * @return array */ private function getOptions(MethodInterface $method) { if ($method->getMethod() == $method::GET) { return ['query' => $method->getAttributes()]; } return ['headers' => ['Content-Type' => 'application/json'], 'body' => json_encode($this->prepareAttributes($method->getAttributes()), JSON_FORCE_OBJECT)]; }