/** * Make sure that the request is created as intended. * * @return void */ public function testCreateRequest() { $options = ['opt' => 'val', 'auth' => [self::MERCHANT_ID, self::SHARED_SECRET], 'headers' => ['User-Agent' => 'a-user-agent']]; $this->client->expects($this->any())->method('createRequest')->with('uri', 'method', $options)->will($this->returnValue($this->request)); $request = $this->object->createRequest('method', 'uri', ['opt' => 'val']); $this->assertSame($this->request, $request); }
/** * Sends a HTTP request to the specified url. * * @param string $method HTTP method, e.g. 'GET' * @param string $url Request destination * @param array $options Request options * * @throws ConnectorException When the API replies with an error response * @throws RequestException When an error is encountered * @throws \LogicException When Guzzle cannot populate the response * * @return ResponseValidator */ protected function request($method, $url, array $options = []) { $request = $this->connector->createRequest($url, $method, $options); return new ResponseValidator($this->connector->send($request)); }