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
자세한 내용을 제공하기 위해 제 질문을 편집했습니다. 죄송합니다. – jini