本文整理匯總了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');
}