findAll() public method

Class method to find all Subscriptions
public findAll ( $page = 1, $per_page = 20, $order_by = self::ORDERBY_CREATED_AT, $order_dir = self::ORDERDIR_ASC ) : DataSift_Pylon
return DataSift_Pylon
Esempio n. 1
0
 public function testFindAll()
 {
     $response = array('response_code' => 200, 'data' => array('count' => 2, 'page' => 1, 'pages' => 1, 'per_page' => 25, 'subscriptions' => array(array('volume' => 12300, 'start' => 1436085514, 'end' => 1436089932, 'status' => 'stopped', 'name' => 'example1', 'reached_capacity' => false, 'identity_id' => '58d783dd98dd6b8bc7a39d73928fa7cf', 'hash' => '37fdfa811a6fb20785eecb9de9dd2d3e', 'remaining_index_capacity' => 998400, 'remaining_account_capacity' => 927200), array('volume' => 14700, 'start' => 1436087600, 'end' => 1436089999, 'status' => 'stopped', 'name' => 'example2', 'reached_capacity' => false, 'identity_id' => '58d783dd98dd6b8bc7a39d73928fa7cf', 'hash' => '9jrh3nq811a6fb20785eecb9de9dd2d3f', 'remaining_index_capacity' => 986500, 'remaining_account_capacity' => 927200))), 'rate_limit' => 200, 'rate_limit_remaining' => 150);
     DataSift_MockApiClient::setResponse($response);
     $pylon = new DataSift_Pylon($this->user);
     $subscriptions = $pylon->findAll();
     $this->assertCount(2, $subscriptions, 'Expecting 2 subscription arrays');
     $this->assertEquals($subscriptions[0]->getHash(), '37fdfa811a6fb20785eecb9de9dd2d3e', 'Hash did not match');
     $this->assertEquals($subscriptions[1]->getHash(), '9jrh3nq811a6fb20785eecb9de9dd2d3f', 'Hash did not match');
     $this->assertEquals($subscriptions[0]->getName(), 'example1', 'Name did not match');
 }