/** * @param string $method * @param array $arguments * @return ResponseInterface * @throws RequestException When an error is encountered */ public function request($method, $arguments) { $options['query'] = array_merge($this->options, $arguments); $options['cert'] = $this->certificate; $response = $this->client->get($this->getEndpoint($method), $options); return $this->factory->getResponse($response); }
public function testError403() { $response = m::mock(GuzzleResponseInterface::class); $response->shouldReceive('getBody')->andReturn($this->tostream(TestFixtures::getFixture('failure_403'))); $gigyaResponse = $this->factory->getResponse($response); static::assertInstanceOf('Graze\\Gigya\\Response\\Response', $gigyaResponse); static::assertEquals(403, $gigyaResponse->getStatusCode()); static::assertEquals(403005, $gigyaResponse->getErrorCode()); static::assertEquals('Forbidden', $gigyaResponse->getStatusReason()); static::assertEquals('Unauthorized user', $gigyaResponse->getErrorMessage()); static::assertEquals('The user billyBob cannot login', $gigyaResponse->getErrorDetails()); }
public function testNoBody() { $response = m::mock('GuzzleHttp\\Message\\ResponseInterface'); $response->shouldReceive('getBody')->andReturn(''); $this->validator->shouldReceive('assert')->with($response)->andThrow(new UnknownResponseException($response)); static::setExpectedException('Graze\\Gigya\\Exceptions\\UnknownResponseException', 'The contents of the response could not be determined'); $this->factory->getResponse($response); }