/**
  * @test
  * @expectedException \Github\Exception\ApiLimitExceedException
  */
 public function shouldThrowExceptionWhenApiIsExceeded()
 {
     $path = '/some/path';
     $parameters = array('a' => 'b');
     $headers = array('c' => 'd');
     $response = new Response();
     $response->addHeader('HTTP/1.1 403 Forbidden');
     $response->addHeader('X-RateLimit-Remaining: 0');
     $httpClient = new TestHttpClient(array(), $this->getBrowserMock());
     $httpClient->setFakeResponse($response);
     $httpClient->get($path, $parameters, $headers);
 }
Esempio n. 2
0
 /**
  * @test
  * @expectedException \Github\Exception\ApiLimitExceedException
  */
 public function shouldThrowExceptionWhenApiIsExceeded()
 {
     $path = '/some/path';
     $parameters = array('a = b');
     $headers = array('c' => 'd');
     $response = new Response(403);
     $response->addHeader('X-RateLimit-Remaining', 0);
     $mockPlugin = new MockPlugin();
     $mockPlugin->addResponse($response);
     $client = new GuzzleClient('http://123.com/');
     $client->addSubscriber($mockPlugin);
     $httpClient = new TestHttpClient(array(), $client);
     $httpClient->get($path, $parameters, $headers);
 }