本文整理汇总了PHP中Jelly::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Jelly::count方法的具体用法?PHP Jelly::count怎么用?PHP Jelly::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jelly
的用法示例。
在下文中一共展示了Jelly::count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_multiple_select
/**
* Tests basic SELECT functionality and that collections are returned
* relatively sane.
*
* @dataProvider provider_multiple_select
* @param Jelly $result
* @param int $count
* @param bool $is_model
* @return void
*/
public function test_multiple_select($result, $count, $is_model = TRUE)
{
// Set database connection name
$db = parent::$database_connection;
// Ensure the count matches a count() query
$this->assertEquals($result->count($db), $count);
// We can now get our collection
$result = $result->select($db);
// Ensure we have a collection and our counts match
$this->assertTrue($result instanceof Jelly_Collection);
$this->assertEquals(count($result), $count);
// Ensure we can loop through them and all models are loaded
$verify = 0;
foreach ($result as $model) {
if ($is_model) {
$this->assertTrue($model->loaded());
$this->assertTrue($model->saved());
$this->assertTrue($model->id > 0);
}
$verify++;
}
// Ensure the loop and result was the same
$this->assertEquals($verify, $count);
}