* [refac] Refactor the test class of action zen.
This commit is contained in:
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
require_once dirname(__FILE__, 5) . '/test/lib/test.class.php';
|
||||
|
||||
class actionZenTest extends baseTest
|
||||
{
|
||||
protected $moduleName = 'action';
|
||||
protected $className = 'zen';
|
||||
|
||||
/**
|
||||
* Test getTrashesHeaderNavigation method.
|
||||
*
|
||||
* @param array $objectTypeList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTrashesHeaderNavigationTest(array $objectTypeList): array
|
||||
{
|
||||
$result = $this->invokeArgs('getTrashesHeaderNavigation', [$objectTypeList]);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test saveUrlIntoSession method.
|
||||
*
|
||||
* @param string $testUri
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function saveUrlIntoSessionTest(string $testUri = ''): array
|
||||
{
|
||||
// 备份原来的session数据
|
||||
$originalSession = [];
|
||||
$sessionKeys = [
|
||||
'productList', 'productPlanList', 'releaseList', 'programList', 'projectList',
|
||||
'executionList', 'taskList', 'buildList', 'bugList', 'caseList', 'testtaskList',
|
||||
'docList', 'opportunityList', 'riskList', 'trainplanList', 'roomList',
|
||||
'researchplanList', 'researchreportList', 'meetingList', 'designList',
|
||||
'storyLibList', 'issueLibList', 'riskLibList', 'opportunityLibList',
|
||||
'practiceLibList', 'componentLibList'
|
||||
];
|
||||
foreach($sessionKeys as $key) $originalSession[$key] = $this->instance->session->$key ?? null;
|
||||
|
||||
if($this->instance->config->requestType == 'PATH_INFO') $testUri = str_replace('.' . $this->instance->app->viewType, '', $testUri);
|
||||
$this->instance->app->uri = $testUri;
|
||||
|
||||
$this->invokeArgs('saveUrlIntoSession');
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$result = [];
|
||||
foreach($sessionKeys as $key) $result[$key] = $this->instance->session->$key ?? null; // 获取保存后的session数据
|
||||
foreach($originalSession as $key => $value) $this->instance->session->set($key, $value); // 恢复原来的session数据
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test processTrash method.
|
||||
*
|
||||
* @param object $trash
|
||||
* @param array $projectList
|
||||
* @param array $productList
|
||||
* @param array $executionList
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function processTrashTest(object $trash, array $projectList = array(), array $productList = array(), array $executionList = array()): object
|
||||
{
|
||||
$this->invokeArgs('processTrash', [$trash, $projectList, $productList, $executionList]);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $trash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getReplaceNameAndCode method.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $code
|
||||
* @param string $table
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getReplaceNameAndCodeTest(string $name, string $code, string $table): array
|
||||
{
|
||||
// 创建模拟的重复对象和原对象
|
||||
$repeatObject = new stdClass();
|
||||
$repeatObject->name = $name;
|
||||
$repeatObject->code = $code;
|
||||
|
||||
$object = new stdClass();
|
||||
$object->code = $code;
|
||||
|
||||
$result = $this->invokeArgs('getReplaceNameAndCode', [$repeatObject, $object, $table]);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test checkActionExist method.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @access public
|
||||
* @return object|array
|
||||
*/
|
||||
public function checkActionExistTest(int $actionID): object|array
|
||||
{
|
||||
$result = $this->invokeArgs('checkActionExist', [$actionID]);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getConfirmNoMessage method.
|
||||
*
|
||||
* @param string $repeatName
|
||||
* @param string $replaceName
|
||||
* @param string $replaceCode
|
||||
* @param string $objectName
|
||||
* @param string $objectCode
|
||||
* @param string $testType
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getConfirmNoMessageTest(string $repeatName, string $replaceName, string $replaceCode, string $objectName, string $objectCode, string $testType): string
|
||||
{
|
||||
// 创建模拟的重复对象
|
||||
$repeatObject = new stdClass();
|
||||
$repeatObject->name = $repeatName;
|
||||
$repeatObject->code = ($testType == 'both' && $replaceCode) ? substr($replaceCode, 0, -2) : (($testType == 'code' && $replaceCode) ? substr($replaceCode, 0, -2) : '');
|
||||
|
||||
// 创建模拟的原对象
|
||||
$object = new stdClass();
|
||||
$object->name = $objectName;
|
||||
$object->code = $objectCode;
|
||||
|
||||
// 创建模拟的旧Action对象
|
||||
$oldAction = new stdClass();
|
||||
switch($testType) {
|
||||
case 'both':
|
||||
$oldAction->objectType = 'product';
|
||||
break;
|
||||
case 'name':
|
||||
$oldAction->objectType = 'story';
|
||||
break;
|
||||
case 'code':
|
||||
$oldAction->objectType = 'task';
|
||||
break;
|
||||
case 'none':
|
||||
$oldAction->objectType = 'project';
|
||||
break;
|
||||
case 'name_only':
|
||||
$oldAction->objectType = 'bug';
|
||||
break;
|
||||
}
|
||||
|
||||
$result = $this->invokeArgs('getConfirmNoMessage', [$repeatObject, $object, $oldAction, $replaceName, $replaceCode]);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test recoverObject method.
|
||||
*
|
||||
* @param string $repeatName
|
||||
* @param string $repeatCode
|
||||
* @param string $replaceName
|
||||
* @param string $replaceCode
|
||||
* @param string $testType
|
||||
* @access public
|
||||
* @return object|string
|
||||
*/
|
||||
public function recoverObjectTest(string $repeatName, string $repeatCode, string $replaceName, string $replaceCode, string $testType): object|string
|
||||
{
|
||||
// 创建模拟的重复对象
|
||||
$repeatObject = new stdClass();
|
||||
$repeatObject->name = $repeatName;
|
||||
$repeatObject->code = $repeatCode;
|
||||
|
||||
// 创建模拟的原对象
|
||||
$object = new stdClass();
|
||||
$object->name = $repeatName;
|
||||
$object->code = $repeatCode;
|
||||
|
||||
// 创建模拟的旧Action对象
|
||||
$oldAction = new stdClass();
|
||||
$oldAction->objectID = 1;
|
||||
$oldAction->objectType = 'product';
|
||||
|
||||
// 设置数据表
|
||||
$table = TABLE_PRODUCT;
|
||||
|
||||
if($testType == 'empty' || ($testType == 'none'))
|
||||
{
|
||||
// 如果是测试无变化的情况,直接返回
|
||||
if(empty($replaceName) && empty($replaceCode)) return 'no_change';
|
||||
|
||||
// 模拟无重复的情况,修改重复对象的名称和代码
|
||||
if($testType == 'none')
|
||||
{
|
||||
$repeatObject->name = '不重复产品';
|
||||
$repeatObject->code = 'no_repeat';
|
||||
}
|
||||
}
|
||||
|
||||
$this->invokeArgs('recoverObject', [$repeatObject, $object, $replaceName, $replaceCode, $table, $oldAction]);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
// 检查更新结果
|
||||
$updatedObject = $this->instance->dao->select('*')->from($table)->where('id')->eq($oldAction->objectID)->fetch();
|
||||
if(!$updatedObject) return 'no_object';
|
||||
|
||||
// 根据测试类型返回相应的结果
|
||||
switch($testType) {
|
||||
case 'both':
|
||||
return (object)array('name' => $updatedObject->name, 'code' => $updatedObject->code);
|
||||
case 'name':
|
||||
return (object)array('name' => $updatedObject->name);
|
||||
case 'code':
|
||||
return (object)array('code' => $updatedObject->code);
|
||||
case 'none':
|
||||
case 'empty':
|
||||
return 'no_change';
|
||||
default:
|
||||
return $updatedObject;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test restoreStages method.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $confirmChange
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function restoreStagesTest(int $executionID, string $confirmChange = 'no')
|
||||
{
|
||||
$action = new stdClass();
|
||||
$action->objectID = $executionID;
|
||||
|
||||
$result = $this->invokeArgs('restoreStages', [$action, $confirmChange]);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -12,22 +12,22 @@ cid=0
|
||||
- 属性objectType @product
|
||||
- 步骤2:检查不存在的操作记录
|
||||
- 属性result @fail
|
||||
- 属性message @页面不存在。
|
||||
- 属性message @抱歉,您访问的对象不存在!
|
||||
- 步骤3:检查无效ID为0
|
||||
- 属性result @fail
|
||||
- 属性message @页面不存在。
|
||||
- 属性message @抱歉,您访问的对象不存在!
|
||||
- 步骤4:检查负数ID
|
||||
- 属性result @fail
|
||||
- 属性message @页面不存在。
|
||||
- 属性message @抱歉,您访问的对象不存在!
|
||||
- 步骤5:检查极大ID
|
||||
- 属性result @fail
|
||||
- 属性message @页面不存在。
|
||||
- 属性message @抱歉,您访问的对象不存在!
|
||||
|
||||
*/
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
|
||||
include dirname(__FILE__, 2) . '/lib/zen.class.php';
|
||||
|
||||
// 2. zendata数据准备(根据需要配置)
|
||||
zendata('action')->loadYaml('action_checkactionexist', false, 2)->gen(10);
|
||||
@@ -36,11 +36,11 @@ zendata('action')->loadYaml('action_checkactionexist', false, 2)->gen(10);
|
||||
su('admin');
|
||||
|
||||
// 4. 创建测试实例(变量名与模块名一致)
|
||||
$actionTest = new actionTest();
|
||||
$actionTest = new actionZenTest();
|
||||
|
||||
// 5. 🔴 强制要求:必须包含至少5个测试步骤
|
||||
r($actionTest->checkActionExistTest(1)) && p('id,objectType') && e('1,product'); // 步骤1:检查存在的操作记录
|
||||
r($actionTest->checkActionExistTest(999)) && p('result,message') && e('fail,页面不存在。'); // 步骤2:检查不存在的操作记录
|
||||
r($actionTest->checkActionExistTest(0)) && p('result,message') && e('fail,页面不存在。'); // 步骤3:检查无效ID为0
|
||||
r($actionTest->checkActionExistTest(-1)) && p('result,message') && e('fail,页面不存在。'); // 步骤4:检查负数ID
|
||||
r($actionTest->checkActionExistTest(99999)) && p('result,message') && e('fail,页面不存在。'); // 步骤5:检查极大ID
|
||||
r($actionTest->checkActionExistTest(1)) && p('id,objectType') && e('1,product'); // 步骤1:检查存在的操作记录
|
||||
r($actionTest->checkActionExistTest(999)) && p('result,message') && e('fail,抱歉,您访问的对象不存在!'); // 步骤2:检查不存在的操作记录
|
||||
r($actionTest->checkActionExistTest(0)) && p('result,message') && e('fail,抱歉,您访问的对象不存在!'); // 步骤3:检查无效ID为0
|
||||
r($actionTest->checkActionExistTest(-1)) && p('result,message') && e('fail,抱歉,您访问的对象不存在!'); // 步骤4:检查负数ID
|
||||
r($actionTest->checkActionExistTest(99999)) && p('result,message') && e('fail,抱歉,您访问的对象不存在!'); // 步骤5:检查极大ID
|
||||
@@ -8,7 +8,7 @@ timeout=0
|
||||
cid=0
|
||||
|
||||
- 步骤1:名称和代码都重复 @系统内已有同名、同代号的产品,恢复后名称为"product_1"、代号为"PD0001_1"。
|
||||
- 步骤2:仅名称重复 @系统内已有同名的,恢复后名称为"story_1"。
|
||||
- 步骤2:仅名称重复 @系统内已有同名的研发需求,恢复后名称为"story_1"。
|
||||
- 步骤3:仅代码重复 @系统内已有同名、同代号的任务,恢复后名称为"T0001_1"、代号为"T0001_1"。
|
||||
- 步骤4:名称和代码都不重复 @0
|
||||
- 步骤5:代码为空的情况下仅名称重复 @系统内已有同名的Bug,恢复后名称为"bug_1"。
|
||||
@@ -17,17 +17,17 @@ cid=0
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
|
||||
include dirname(__FILE__, 2) . '/lib/zen.class.php';
|
||||
|
||||
// 2. 用户登录(选择合适角色)
|
||||
su('admin');
|
||||
|
||||
// 3. 创建测试实例(变量名与模块名一致)
|
||||
$actionTest = new actionTest();
|
||||
$actionTest = new actionZenTest();
|
||||
|
||||
// 4. 强制要求:必须包含至少5个测试步骤
|
||||
r($actionTest->getConfirmNoMessageTest('product', 'product_1', 'PD0001_1', 'product', 'PD0001', 'both')) && p() && e('系统内已有同名、同代号的产品,恢复后名称为"product_1"、代号为"PD0001_1"。'); // 步骤1:名称和代码都重复
|
||||
r($actionTest->getConfirmNoMessageTest('story', 'story_1', '', 'story', '', 'name')) && p() && e('系统内已有同名的,恢复后名称为"story_1"。'); // 步骤2:仅名称重复
|
||||
r($actionTest->getConfirmNoMessageTest('story', 'story_1', '', 'story', '', 'name')) && p() && e('系统内已有同名的研发需求,恢复后名称为"story_1"。'); // 步骤2:仅名称重复
|
||||
r($actionTest->getConfirmNoMessageTest('', 'T0001_1', 'T0001_1', '', 'T0001', 'code')) && p() && e('系统内已有同名、同代号的任务,恢复后名称为"T0001_1"、代号为"T0001_1"。'); // 步骤3:仅代码重复
|
||||
r($actionTest->getConfirmNoMessageTest('project1', 'project1_1', 'P001_1', 'project2', 'P002', 'none')) && p() && e('0'); // 步骤4:名称和代码都不重复
|
||||
r($actionTest->getConfirmNoMessageTest('bug', 'bug_1', '', 'bug', '', 'name_only')) && p() && e('系统内已有同名的Bug,恢复后名称为"bug_1"。'); // 步骤5:代码为空的情况下仅名称重复
|
||||
@@ -21,7 +21,7 @@ cid=0
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
|
||||
include dirname(__FILE__, 2) . '/lib/zen.class.php';
|
||||
|
||||
// 2. zendata数据准备(根据需要配置)
|
||||
$table = zenData('project');
|
||||
@@ -40,11 +40,11 @@ $actionTable->gen(5);
|
||||
su('admin');
|
||||
|
||||
// 4. 创建测试实例(变量名与模块名一致)
|
||||
$actionTest = new actionTest();
|
||||
$actionTest = new actionZenTest();
|
||||
|
||||
// 5. 🔴 强制要求:必须包含至少5个测试步骤
|
||||
r($actionTest->getReplaceNameAndCodeTest('项目A', 'PROJA', TABLE_PROJECT)) && p('0,1') && e('项目A_3,PROJA_3'); // 步骤1:正常情况下获取重复名称和代号的替换方案
|
||||
r($actionTest->getReplaceNameAndCodeTest('项目B', '', TABLE_PROJECT)) && p('0') && e('项目B_1'); // 步骤2:只有名称重复,代号为空的情况
|
||||
r($actionTest->getReplaceNameAndCodeTest('新项目', 'PROJB', TABLE_PROJECT)) && p('1') && e('PROJB_1'); // 步骤3:只有代号重复的情况
|
||||
r($actionTest->getReplaceNameAndCodeTest('新项目', 'PROJB', TABLE_PROJECT)) && p('1') && e('PROJB_1'); // 步骤3:只有代号重复的情况
|
||||
r($actionTest->getReplaceNameAndCodeTest('全新项目', 'NEWPROJ', TABLE_PROJECT)) && p('0') && e('全新项目_1'); // 步骤4:名称和代号都不重复的情况
|
||||
r($actionTest->getReplaceNameAndCodeTest('项目C', 'PROJC', TABLE_PROJECT)) && p('0,1') && e('项目C_1,PROJC_1'); // 步骤5:存在一个重复名称时的情况
|
||||
@@ -20,7 +20,7 @@ cid=0
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
|
||||
include dirname(__FILE__, 2) . '/lib/zen.class.php';
|
||||
|
||||
// 2. zendata数据准备(根据需要配置)
|
||||
// 该方法不需要数据表数据
|
||||
@@ -29,7 +29,7 @@ include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
|
||||
su('admin');
|
||||
|
||||
// 4. 创建测试实例(变量名与模块名一致)
|
||||
$actionTest = new actionTest();
|
||||
$actionTest = new actionZenTest();
|
||||
|
||||
// 5. 强制要求:必须包含至少5个测试步骤
|
||||
// 步骤1:测试空对象类型列表
|
||||
|
||||
@@ -8,7 +8,7 @@ timeout=0
|
||||
cid=0
|
||||
|
||||
- 步骤1:pivot类型JSON名称处理属性objectName @中文名称
|
||||
- 步骤2:普通对象名称处理(包含HTML链接)属性objectName @/^<a.*>测试Bug<\/a>$/
|
||||
- 步骤2:普通对象名称处理(包含HTML链接)属性objectName @<a href='bug-view-1.html' title='测试Bug' >测试Bug</a>
|
||||
- 步骤3:项目信息为空(ID不匹配)属性project @~~
|
||||
- 步骤4:属性累积现象验证属性product @测试项目
|
||||
- 步骤5:属性累积现象验证属性execution @测试产品
|
||||
@@ -17,7 +17,7 @@ cid=0
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
|
||||
include dirname(__FILE__, 2) . '/lib/zen.class.php';
|
||||
|
||||
// 2. zendata数据准备(根据需要配置)
|
||||
// 此测试不需要实际数据库数据,直接在测试中传入模拟数据
|
||||
@@ -26,15 +26,17 @@ include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
|
||||
su('admin');
|
||||
|
||||
// 4. 创建测试实例(变量名与模块名一致)
|
||||
$actionTest = new actionTest();
|
||||
$actionTest = new actionZenTest();
|
||||
|
||||
// 5. 🔴 强制要求:必须包含至少5个测试步骤
|
||||
r($actionTest->processTrashTest((object)array('objectType' => 'pivot', 'objectName' => '{"zh-cn":"中文名称","en":"English Name"}', 'objectID' => 1, 'project' => 0, 'execution' => 0), array(), array(), array())) && p('objectName') && e('中文名称'); // 步骤1:pivot类型JSON名称处理
|
||||
$trash1 = (object)array('objectType' => 'pivot', 'objectID' => 1, 'project' => 0, 'execution' => 0, 'objectName' => '{"zh-cn":"中文名称","en":"English Name"}');
|
||||
$trash2 = (object)array('objectType' => 'bug', 'objectID' => 1, 'project' => 0, 'execution' => 0, 'objectName' => '测试Bug');
|
||||
$trash3 = (object)array('objectType' => 'task', 'objectID' => 1, 'project' => 1, 'execution' => 0, 'objectName' => '测试任务');
|
||||
$trash4 = (object)array('objectType' => 'story', 'objectID' => 2, 'project' => 0, 'execution' => 0, 'objectName' => '测试需求');
|
||||
$trash5 = (object)array('objectType' => 'task', 'objectID' => 3, 'project' => 0, 'execution' => 1, 'objectName' => '测试任务2');
|
||||
|
||||
r($actionTest->processTrashTest((object)array('objectType' => 'bug', 'objectName' => '测试Bug', 'objectID' => 1, 'project' => 0, 'execution' => 0), array(), array(), array())) && p('objectName') && e('/^<a.*>测试Bug<\/a>$/'); // 步骤2:普通对象名称处理(包含HTML链接)
|
||||
|
||||
r($actionTest->processTrashTest((object)array('objectType' => 'task', 'objectName' => '测试任务', 'objectID' => 1, 'project' => 1, 'execution' => 0), array(1 => (object)array('name' => '测试项目', 'deleted' => 0)), array(), array())) && p('project') && e('~~'); // 步骤3:项目信息为空(ID不匹配)
|
||||
|
||||
r($actionTest->processTrashTest((object)array('objectType' => 'story', 'objectName' => '测试需求', 'objectID' => 2, 'project' => 0, 'execution' => 0), array(), array(2 => (object)array('productTitle' => '测试产品', 'productDeleted' => 0)), array())) && p('product') && e('测试项目'); // 步骤4:属性累积现象验证
|
||||
|
||||
r($actionTest->processTrashTest((object)array('objectType' => 'task', 'objectName' => '测试任务2', 'objectID' => 3, 'project' => 0, 'execution' => 1), array(), array(), array(1 => (object)array('name' => '测试执行', 'deleted' => 0)))) && p('execution') && e('测试产品'); // 步骤5:属性累积现象验证
|
||||
r($actionTest->processTrashTest($trash1, array(), array(), array())) && p('objectName') && e('中文名称'); // 步骤1:pivot类型JSON名称处理
|
||||
r($actionTest->processTrashTest($trash2, array(), array(), array())) && p('objectName') && e("<a href='bug-view-1.html' title='测试Bug' >测试Bug</a>"); // 步骤2:普通对象名称处理(包含HTML链接)
|
||||
r($actionTest->processTrashTest($trash3, array(1 => (object)array('name' => '测试项目', 'deleted' => 0)), array(), array())) && p('project') && e('~~'); // 步骤3:项目信息为空(ID不匹配)
|
||||
r($actionTest->processTrashTest($trash4, array(), array(2 => (object)array('productTitle' => '测试产品', 'productDeleted' => 0)), array())) && p('product') && e('测试项目'); // 步骤4:属性累积现象验证
|
||||
r($actionTest->processTrashTest($trash5, array(), array(), array(1 => (object)array('name' => '测试执行', 'deleted' => 0)))) && p('execution') && e('测试产品'); // 步骤5:属性累积现象验证
|
||||
@@ -19,7 +19,7 @@ cid=0
|
||||
|
||||
// 1. 导入依赖(路径固定,不可修改)
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
|
||||
include dirname(__FILE__, 2) . '/lib/zen.class.php';
|
||||
|
||||
// 2. zendata数据准备(根据需要配置)
|
||||
$table = zenData('action');
|
||||
@@ -42,7 +42,7 @@ $productTable->gen(5);
|
||||
su('admin');
|
||||
|
||||
// 4. 创建测试实例(变量名与模块名一致)
|
||||
$actionTest = new actionTest();
|
||||
$actionTest = new actionZenTest();
|
||||
|
||||
// 5. 🔴 强制要求:必须包含至少5个测试步骤
|
||||
r($actionTest->recoverObjectTest('产品1', 'product1', '产品1_1', 'product1_1', 'both')) && p('name,code') && e('产品1_1,product1_1'); // 步骤1:名称和代码都重复时恢复对象
|
||||
|
||||
@@ -7,26 +7,26 @@ title=测试 actionZen::restoreStages();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行actionTest模块的restoreStagesZenTest方法,参数是16, 'no' @1
|
||||
- 执行actionTest模块的restoreStagesZenTest方法,参数是17, 'no' @父阶段未创建过任务,不能恢复子阶段。
|
||||
- 执行actionTest模块的restoreStagesZenTest方法,参数是18, 'no' @同级不能存在多种执行类型。
|
||||
- 执行actionTest模块的restoreStagesZenTest方法,参数是19, 'no' @已删除的父阶段是:阶段2,阶段3,是否要同时恢复这些阶段?
|
||||
- 执行actionTest模块的restoreStagesTest方法,参数是16, 'no' @1
|
||||
- 执行actionTest模块的restoreStagesTest方法,参数是17, 'no' @父阶段未创建过任务,不能恢复子阶段。
|
||||
- 执行actionTest模块的restoreStagesTest方法,参数是18, 'no' @同级不能存在多种执行类型。
|
||||
- 执行actionTest模块的restoreStagesTest方法,参数是19, 'no' @已删除的父阶段是:阶段2,阶段3,是否要同时恢复这些阶段?
|
||||
|
||||
- 执行actionTest模块的restoreStagesZenTest方法,参数是20, 'yes' @1
|
||||
- 执行actionTest模块的restoreStagesTest方法,参数是20, 'yes' @1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
|
||||
include dirname(__FILE__, 2) . '/lib/zen.class.php';
|
||||
|
||||
// 简化的测试数据准备
|
||||
zenData('project')->gen(20);
|
||||
|
||||
su('admin');
|
||||
|
||||
$actionTest = new actionTest();
|
||||
$actionTest = new actionZenTest();
|
||||
|
||||
r($actionTest->restoreStagesZenTest(16, 'no')) && p() && e('1');
|
||||
r($actionTest->restoreStagesZenTest(17, 'no')) && p() && e('父阶段未创建过任务,不能恢复子阶段。');
|
||||
r($actionTest->restoreStagesZenTest(18, 'no')) && p() && e('同级不能存在多种执行类型。');
|
||||
r($actionTest->restoreStagesZenTest(19, 'no')) && p() && e('已删除的父阶段是:阶段2,阶段3,是否要同时恢复这些阶段?');
|
||||
r($actionTest->restoreStagesZenTest(20, 'yes')) && p() && e('1');
|
||||
r($actionTest->restoreStagesTest(16, 'no')) && p() && e('1');
|
||||
r($actionTest->restoreStagesTest(17, 'no')) && p() && e('父阶段未创建过任务,不能恢复子阶段。');
|
||||
r($actionTest->restoreStagesTest(18, 'no')) && p() && e('同级不能存在多种执行类型。');
|
||||
r($actionTest->restoreStagesTest(19, 'no')) && p() && e('已删除的父阶段是:阶段2,阶段3,是否要同时恢复这些阶段?');
|
||||
r($actionTest->restoreStagesTest(20, 'yes')) && p() && e('1');
|
||||
|
||||
@@ -7,26 +7,26 @@ title=测试 actionZen::saveUrlIntoSession();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行actionTest模块的saveUrlIntoSessionTest方法,参数是'' 属性productList @
|
||||
- 执行actionTest模块的saveUrlIntoSessionTest方法,参数是'/project-browse-1.html' 属性productList @/project-browse-1.html
|
||||
- 执行actionTest模块的saveUrlIntoSessionTest方法,参数是'/bug-browse.html' 属性bugList @/bug-browse.html
|
||||
- 执行actionTest模块的saveUrlIntoSessionTest方法,参数是'/product-browse.html' @26
|
||||
- 执行actionTest模块的saveUrlIntoSessionTest方法,参数是'/test.html'
|
||||
- 属性productList @/test.html
|
||||
- 属性bugList @/test.html
|
||||
- 属性docList @/test.html
|
||||
- 执行actionTest模块的saveUrlIntoSessionTest方法,参数是'' 属性productList @~~
|
||||
- 执行actionTest模块的saveUrlIntoSessionTest方法,参数是'/product-browse.html' @26
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
|
||||
include dirname(__FILE__, 2) . '/lib/zen.class.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
$actionTest = new actionTest();
|
||||
$actionTest = new actionZenTest();
|
||||
|
||||
r($actionTest->saveUrlIntoSessionTest('')) && p('productList') && e('');
|
||||
r($actionTest->saveUrlIntoSessionTest('/project-browse-1.html')) && p('productList') && e('/project-browse-1.html');
|
||||
r($actionTest->saveUrlIntoSessionTest('/bug-browse.html')) && p('bugList') && e('/bug-browse.html');
|
||||
r(count($actionTest->saveUrlIntoSessionTest('/product-browse.html'))) && p() && e(26);
|
||||
r($actionTest->saveUrlIntoSessionTest('/test.html')) && p('productList,bugList,docList') && e('/test.html,/test.html,/test.html');
|
||||
r($actionTest->saveUrlIntoSessionTest('/project-browse-1.html')) && p('productList') && e('/project-browse-1.html');
|
||||
r($actionTest->saveUrlIntoSessionTest('/bug-browse.html')) && p('bugList') && e('/bug-browse.html');
|
||||
r($actionTest->saveUrlIntoSessionTest('/test.html')) && p('productList,bugList,docList') && e('/test.html,/test.html,/test.html');
|
||||
r($actionTest->saveUrlIntoSessionTest('')) && p('productList') && e('~~');
|
||||
r(count($actionTest->saveUrlIntoSessionTest('/product-browse.html'))) && p() && e(26);
|
||||
Reference in New Issue
Block a user