getcount.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 79 行
PHP
79 行
<?php//// $Id: GetCount.php,v 1.3 2005/01/27 22:21:34 quipo Exp $//class tests_GetCount extends tests_UnitTest{ function _setup($mode) { $this->user = new tests_Common(TABLE_USER); switch ($mode) { case '6': $this->user->add(array('name'=>'x')); $this->user->add(array('name'=>'y')); $this->user->add(array('name'=>'z')); case '3': $this->user->add(array('name'=>'x')); $this->user->add(array('name'=>'y')); $this->user->add(array('name'=>'z')); break; } } function test_getCount3() { $this->_setup(3); $this->assertEquals(3,$this->user->getCount(),'Wrong count after inserting 3 rows'); } function test_getCount6() { $this->_setup(6); $this->assertEquals(6,$this->user->getCount(),'Wrong count after inserting 6 rows'); } function test_getCountGrouped3() { $this->_setup(6); $this->user->setGroup('name'); $this->assertEquals(3,$this->user->getCount(),'Wrong count after 6 inserted and grouping them by name'); } function test_getCountGrouped2() { $this->_setup(6); $this->user->setWhere("name='z'"); $this->assertEquals(2,$this->user->getCount(),'setWhere and setGroup should have resulted in two'); } function test_getCountGrouped1() { $this->_setup(6); $this->user->setGroup('name'); $this->user->setWhere("name='z'"); $this->assertEquals(1,$this->user->getCount(),'setWhere and setGroup should have resulted in one'); } function test_getCountGrouped0() { $this->_setup(6); $this->user->setGroup('name'); $this->user->setWhere("name='xxx'"); $this->assertEquals(0,$this->user->getCount(),'setWhere and setGroup should have resulted in one'); } function test_getCountWithOffset() { $this->_setup(6); $this->user->setLimit(0, 5); $this->assertEquals(6, $this->user->getCount(),'setLimit and setGroup should have resulted in one'); $this->user->setLimit(5, 5); $this->assertEquals(6, $this->user->getCount(),'setLimit and setGroup should have resulted in one'); }}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?