/**
  * @test
  */
 public function shouldReturnNextResultsWithGivenModel()
 {
     $data = array(array('id' => 1), array('id' => 2), array('id' => 3));
     $contentRange = array('count' => 200, 'end' => 2, 'start' => 0);
     $response = $this->getMockBuilder('Bitreserve\\HttpClient\\Message\\Response')->disableOriginalConstructor()->getMock();
     $response->expects($this->once())->method('getContent')->will($this->returnValue($data));
     $response->expects($this->once())->method('getContentRange')->will($this->returnValue($contentRange));
     $client = $this->getMockBuilder('Bitreserve\\BitreserveClient')->disableOriginalConstructor()->setMethods(array('get'))->getMock();
     $client->expects($this->once())->method('get')->with('/path', array(), array('range' => 'items=0-49'))->will($this->returnValue($response));
     $pager = new Paginator($client, '/path');
     $pager->setModel('Bitreserve\\Model\\Transaction');
     $transactions = $pager->getNext();
     foreach ($transactions as $transaction) {
         $this->assertInstanceOf('Bitreserve\\Model\\Transaction', $transaction);
     }
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function getTransactions()
 {
     $pager = new Paginator($this->client, '/me/transactions');
     $pager->setModel('Bitreserve\\Model\\Transaction');
     return $pager;
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function getTransactions()
 {
     $pager = new Paginator($this->client, sprintf('/me/cards/%s/transactions', $this->id));
     $pager->setModel('Bitreserve\\Model\\Transaction');
     return $pager;
 }