/**
  * performs the request.
  *
  * @param string $url
  * @param string $method
  * @param array  $params
  *
  * @return array
  */
 protected function request($url, $method = 'GET', array $params = [])
 {
     $url = $this->sanitizeQuery($url);
     $response = $this->client->request($method, $url, $params);
     if (is_array($response) && isset($response['paging'])) {
         $response = $this->injectPager($response, $method, $url, $params);
     }
     return $response;
 }
 public function it_fetches_next_pages_until_all_are_results_are_fetched(HttpClient $client)
 {
     $client->request('GET', '/foo?page=2', [])->shouldBeCalled()->willReturn(['repos' => ['bazz', 'lol'], 'paging' => ['current_page' => 2, 'total_entries' => 4]]);
     $this->current()->shouldBe('foo');
     $this->next();
     $this->current()->shouldBe('bar');
     $this->key()->shouldBe(1);
     $this->valid()->shouldBe(true);
     $this->next();
     $this->valid()->shouldBe(true);
     $this->current()->shouldBe('bazz');
     $this->next();
     $this->current()->shouldBe('lol');
     $this->next();
     $this->valid()->shouldBe(false);
 }
 public function it_calls_the_correct_url_on_hook(Client $client)
 {
     $client->request('POST', 'github/hook/project_id', [])->willReturn([]);
     $this->hook('project_id')->shouldBeArray();
 }
 public function it_calls_the_correct_url_on_unmerge(Client $client)
 {
     $client->request('GET', 'projects/1337/unmerge/42', [])->willReturn([]);
     $this->unmerge('1337', '42')->shouldBeArray();
 }
 public function it_calls_the_correct_url_on_notifications(Client $client)
 {
     $client->request('GET', 'me/notifications', [])->willReturn([]);
     $this->notifications()->shouldBeArray();
 }
 public function it_calls_the_correct_url_on_close(Client $client)
 {
     $client->request('DELETE', 'sessions', [])->willReturn([]);
     $this->close()->shouldBeArray();
 }
 public function it_calls_the_correct_url_on_comments(Client $client)
 {
     $client->request('GET', 'users/digitalkaoz/comments?page=1', [])->willReturn([]);
     $this->comments('digitalkaoz')->shouldBeArray();
 }
 public function it_calls_the_correct_url_on_versions(Client $client)
 {
     $client->request('GET', 'products/php/symfony/versions', [])->willReturn([]);
     $this->versions('php', 'symfony')->shouldBeArray();
 }
 public function it_calls_the_correct_url_on_ping(Client $client)
 {
     $client->request('GET', 'services/ping', [])->willReturn([]);
     $this->ping()->shouldBeArray();
 }