【发布时间】:2010-05-20 15:49:28
【问题描述】:
public function getAvailableVideosByRfid($rfid, $count=200) {
$query="SELECT id FROM sometable WHERE rfid='$rfid'";
$result = mysql_query($query);
$count2 = mysql_num_rows($result);
if ($count2){ //this rfid has been claimed
return 0;
}
我的断言是: 1)。 $rfid 是一个 5 个字符长的字符串 2)。我得到了一个有效的结果集
谢谢
请假设我有以下单元测试代码:
class videoSharingTest extends PHPUnit_Framework_TestCase {
/**
* @var videoSharing
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
$this->object = new videoSharing;
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown() {
}
公共函数 testGetAllVideosByRfid() {
******我应该在这里放什么*****
}
【问题讨论】:
-
我真的不明白,你打算如何对这个程序的条目进行单元测试?这不应该是您功能中的验证吗?喜欢 - (is_string($rfid) && strlen($rfid) == 5)
-
我编辑了我的问题以提供更多详细信息。对不起
标签: phpunit simpletest