本文整理汇总了PHP中Dataset::retrieveIterator方法的典型用法代码示例。如果您正苦于以下问题:PHP Dataset::retrieveIterator方法的具体用法?PHP Dataset::retrieveIterator怎么用?PHP Dataset::retrieveIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dataset
的用法示例。
在下文中一共展示了Dataset::retrieveIterator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRetrieveIteratorMethodExists
/**
* 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');
}