Ejemplo n.º 1
0
 public function getContributors($link = null)
 {
     $api = $this->client->api('repo');
     $paginator = new ResultPager($this->client);
     $parameters = [$this->config['contributors']['user'], $this->config['contributors']['repository']];
     return ['contributors' => $paginator->fetch($api, 'contributors', $parameters), 'links' => $paginator->getPagination()];
 }
 /**
  * @test
  *
  * description postFetch
  */
 public function postFetch()
 {
     $pagination = array('first' => 'http://github.com', 'next' => 'http://github.com', 'prev' => 'http://github.com', 'last' => 'http://github.com');
     // response mock
     $responseMock = $this->getMock('Github\\HttpClient\\Message\\Response');
     $responseMock->expects($this->any())->method('getPagination')->will($this->returnValue($pagination));
     $httpClient = $this->getHttpClientMock($responseMock);
     $client = $this->getClientMock($httpClient);
     $paginator = new Github\ResultPager($client);
     $paginator->postFetch();
     $this->assertEquals($paginator->getPagination(), $pagination);
 }
Ejemplo n.º 3
0
    /**
     * @test
     *
     * description postFetch
     */
    public function postFetch()
    {
        $header = <<<TEXT
<http://github.com>; rel="first",
<http://github.com>; rel="next",
<http://github.com>; rel="prev",
<http://github.com>; rel="last",
TEXT;
        $pagination = array('first' => 'http://github.com', 'next' => 'http://github.com', 'prev' => 'http://github.com', 'last' => 'http://github.com');
        // response mock
        $responseMock = $this->getMock('Guzzle\\Http\\Message\\Response', array(), array(200));
        $responseMock->expects($this->any())->method('getHeader')->with('Link')->will($this->returnValue($header));
        $httpClient = $this->getHttpClientMock($responseMock);
        $client = $this->getClientMock($httpClient);
        $paginator = new Github\ResultPager($client);
        $paginator->postFetch();
        $this->assertEquals($paginator->getPagination(), $pagination);
    }