0
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)。我得到一个有效的结果集帮我写一个PHPUnit测试以下方法
谢谢
此外,假设我有以下的单元测试代码:
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) – jpabluz 2010-05-20 15:59:44
我编辑了我的问题以提供更多详细信息。 对不起 – jini 2010-05-20 16:04:42