Ejemplo n.º 1
0
 /**
  * Test retrieve Iterator with an existing methods
  */
 public function testRetrieveIteratorMethodExists()
 {
     $build_data = $this->buildData();
     // getAllPostsByUsernameIterator
     $dataset = new Dataset('all-posts', 'PostDAO', 'getAllPosts', array(930061, 'twitter', 15), 'getAllPostsByUsernameIterator', array('someuser2', 'twitter', 10));
     $iterator = $dataset->retrieveIterator();
     $this->assertTrue(isset($iterator));
     $this->assertIsA($iterator, 'Iterator');
     $cnt = 0;
     foreach ($iterator as $key => $value) {
         $cnt++;
     }
     $this->assertEqual(2, $cnt, 'count should be 2');
     // getAllPostsByUsernameIterator with a limit of 1
     $dataset = new Dataset('all-posts', 'PostDAO', 'getAllPosts', array(930061, 'twitter', 15), 'getAllPostsByUsernameIterator', array('someuser2', 'twitter', 1));
     $iterator = $dataset->retrieveIterator();
     $this->assertTrue(isset($iterator));
     $this->assertIsA($iterator, 'Iterator');
     $cnt = 0;
     foreach ($iterator as $key => $value) {
         $cnt++;
     }
     $this->assertEqual(1, $cnt, 'count should be 1');
     // getAllMentionsIterator
     $dataset = new Dataset('tweets-mostreplies', 'PostDAO', 'getAllPosts', array(930061, 'twitter', 15), 'getAllMentionsIterator', array('someuser1', 10, 'twitter'));
     $iterator = $dataset->retrieveIterator();
     $this->assertTrue(isset($iterator));
     $this->assertIsA($iterator, 'Iterator');
     $cnt = 0;
     foreach ($iterator as $key => $value) {
         $cnt++;
     }
     $this->assertEqual(2, $cnt, 'count should be 2');
 }