* Add New unit testing module, method deletecasebysuiteid.

This commit is contained in:
wangxuepeng
2023-09-04 08:50:04 +00:00
parent 531c06a371
commit ced51cef65
5 changed files with 46 additions and 8 deletions
+1 -1
View File
@@ -415,6 +415,6 @@ class testsuiteModel extends model
*/
public function deleteCaseBySuiteID(array $cases, int $suiteID)
{
$this->dao->delete()->from(TABLE_SUITECASE)->where('`case`')->in($cases)->andWhere('`suite`')->eq($suiteID)->exec();
return $this->dao->delete()->from(TABLE_SUITECASE)->where('`case`')->in($cases)->andWhere('`suite`')->eq($suiteID)->exec();
}
}
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/testsuite.class.php';
su('admin');
zdTable('suitecase')->gen(3);
zdTable('testsuite')->gen(1);
/**
title=测试 testsuiteModel->deleteCaseBySuiteIDTest();
cid=1
pid=1
测试suiteID值为1,$cases=array(1, 2) >> 2
*/
$suiteID = 1;
$cases = array(1, 2);
$testsuite = new testsuiteTest();
r($testsuite->deleteCaseBySuiteIDTest($cases, $suiteID)) && p() && e('2'); //测试suiteID值为1
@@ -8,7 +8,7 @@ zdTable('testsuite')->gen(1);
/**
title=测试 testsuiteModel->delete();
title=测试 testsuiteModel->deleteSuiteByID();
cid=1
pid=1
+6 -6
View File
@@ -12,17 +12,17 @@ cid=1
pid=1
测试productID为1,name正常存在,type为private >> type,public,private
测试productID为1,name为空,type为private >> 『名称』不能为空。
测试productID为1,name为空,type为private >> 『套件名称』不能为空。
测试productID为1,name正常存在,type为public >> type,private,public
测试productID为1,name为空,type为public >> 『名称』不能为空。
测试productID为1,name为空,type为public >> 『套件名称』不能为空。
测试productID为1,name正常存在,type为空 >> type,public,
测试productID为1,name为空,type为空 >> 『名称』不能为空。
测试productID为1,name为空,type为空 >> 『套件名称』不能为空。
测试productID为0,name正常存在,type为private >> 0
测试productID为0,name为空,type为private >> 『名称』不能为空。
测试productID为0,name为空,type为private >> 『套件名称』不能为空。
测试productID为0,name正常存在,type为public >> 0
测试productID为0,name为空,type为public >> 『名称』不能为空。
测试productID为0,name为空,type为public >> 『套件名称』不能为空。
测试productID为0,name正常存在,type为空 >> 0
测试productID为0,name为空,type为空 >> 『名称』不能为空。
测试productID为0,name为空,type为空 >> 『套件名称』不能为空。
*/
$productID = array(1, 0);
+14
View File
@@ -245,4 +245,18 @@ class testsuiteTest
if(dao::isError()) return dao::getError();
return $isClickable ? 1 : 0;
}
/**
* 测试根据套件id删除关联的用例。
* Test delete case by suiteID.
*
* @param int $cases
* @param int $suiteID
* @access public
* @return void
*/
public function deleteCaseBySuiteIDTest($cases, $suiteID)
{
return $this->objectModel->deleteCaseBySuiteID($cases, $suiteID);
}
}