* Refactor testcaseModel::getSceneMenu, rename buildMenuQuery to getScenesForMenu, and modify unit test.
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/testcase.class.php';
|
||||
|
||||
zdTable('scene')->config('modulescene')->gen('170');
|
||||
zdTable('user')->gen('1');
|
||||
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 testcaseModel->buildMenuQuery();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$productIdList = array(0, 1, 2, 41);
|
||||
$moduleIdList = array(0, 1821, 1825);
|
||||
$sceneIdList = array(0, 1, 6, 161);
|
||||
$branchIdList = array('all', '', '0');
|
||||
|
||||
$testcase = new testcaseTest();
|
||||
|
||||
r($testcase->buildMenuQueryTest($productIdList[0], $moduleIdList[0], $sceneIdList[0])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 0 模块 0 起始场景 0 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[0])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 0 模块 0 起始场景 0 分支 all 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[1])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 0 模块 0 起始场景 0 分支 '' 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[2])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `branch` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 0 模块 0 起始场景 0 分支 0 的查询语句
|
||||
|
||||
r($testcase->buildMenuQueryTest($productIdList[0], $moduleIdList[0], $sceneIdList[1])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `path` LIKE '%' ORDER BY `grade` desc,`sort`"); // 测试获取产品 0 模块 0 起始场景 1 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[0], $moduleIdList[0], $sceneIdList[1], $branchIdList[2])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `path` LIKE '%' AND `branch` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 0 模块 0 起始场景 1 分支 0 的查询语句
|
||||
|
||||
r($testcase->buildMenuQueryTest($productIdList[0], $moduleIdList[0], $sceneIdList[2])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `path` LIKE '%' ORDER BY `grade` desc,`sort`"); // 测试获取产品 0 模块 0 起始场景 6 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[0], $moduleIdList[0], $sceneIdList[2], $branchIdList[2])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `path` LIKE '%' AND `branch` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 0 模块 0 起始场景 6 分支 0 的查询语句
|
||||
|
||||
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[0])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' ORDER BY `grade` desc,`sort`"); // 测试获取产品 1 模块 0 起始场景 0 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[0])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' ORDER BY `grade` desc,`sort`"); // 测试获取产品 1 模块 0 起始场景 0 分支 all 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[1])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' ORDER BY `grade` desc,`sort`"); // 测试获取产品 1 模块 0 起始场景 0 分支 '' 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[2])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' AND `branch` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 1 模块 0 起始场景 0 分支 0 的查询语句
|
||||
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[1])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' AND `path` LIKE '%' ORDER BY `grade` desc,`sort`"); // 测试获取产品 1 模块 0 起始场景 1 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[1], $branchIdList[2])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' AND `path` LIKE '%' AND `branch` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 1 模块 0 起始场景 1 分支 0 的查询语句
|
||||
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[1], $sceneIdList[1])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' AND `module` = '1821' AND `path` LIKE '%' ORDER BY `grade` desc,`sort`"); // 测试获取产品 1 模块 1821 起始场景 1 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[1], $sceneIdList[1], $branchIdList[2])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' AND `module` = '1821' AND `path` LIKE '%' AND `branch` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 1 模块 1821 起始场景 1 分支 0 的查询语句
|
||||
|
||||
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[0])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' ORDER BY `grade` desc,`sort`"); // 测试获取产品 41 模块 0 起始场景 0 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[0])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' ORDER BY `grade` desc,`sort`"); // 测试获取产品 41 模块 0 起始场景 0 分支 all 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[1])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' ORDER BY `grade` desc,`sort`"); // 测试获取产品 41 模块 0 起始场景 0 分支 '' 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[2])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' AND `branch` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 41 模块 0 起始场景 0 分支 0 的查询语句
|
||||
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[1])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' AND `path` LIKE '%' ORDER BY `grade` desc,`sort`"); // 测试获取产品 41 模块 0 起始场景 161 的查询语句
|
||||
r($testcase->buildMenuQueryTest($productIdList[1], $moduleIdList[0], $sceneIdList[1], $branchIdList[2])) && p() && e("SELECT * FROM `zt_scene` WHERE `deleted` = '0' AND `product` = '1' AND `path` LIKE '%' AND `branch` = '0' ORDER BY `grade` desc,`sort`"); // 测试获取产品 41 模块 0 起始场景 161 分支 0 的查询语句
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/testcase.class.php';
|
||||
|
||||
zdTable('scene')->config('moduletreescene')->gen('20');
|
||||
zdTable('user')->gen('1');
|
||||
|
||||
su('admin');
|
||||
|
||||
global $tester;
|
||||
$scenes = $tester->dao->update(TABLE_SCENE)->set("path= replace(`path`,',0,', ',')")->exec();
|
||||
$scenes = $tester->dao->update(TABLE_SCENE)->set("path= replace(`path`,',0,', ',')")->exec();
|
||||
|
||||
/**
|
||||
|
||||
title=测试 testcaseModel->getSceneMenu();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$productIdList = array(1, 41);
|
||||
$moduleIdList = array(0, 1, 2);
|
||||
$sceneIdList = array(0, 6, 16);
|
||||
$branchIdList = array('all', '0', 1);
|
||||
$currentScene = array(0, 6, 16);
|
||||
$emptyMenu = array(false, true);
|
||||
|
||||
$testcase = new testcaseTest();
|
||||
|
||||
r($testcase->getSceneMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[0], $currentScene[0], $emptyMenu[0])) && p() && e('/,/场景1,/场景1/场景2,/场景3,/场景4,/场景5,/场景6,/场景6/场景7,/场景6/场景7/场景8,/场景9,/场景10'); // 测试获取产品 1 模块 0 起始场景 0 分支 all 当前场景 0 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[0], $moduleIdList[1], $sceneIdList[0], $branchIdList[0], $currentScene[0], $emptyMenu[0])) && p() && e('/,/场景6,/场景6/场景7,/场景6/场景7/场景8,/场景9,/场景10'); // 测试获取产品 1 模块 1 起始场景 0 分支 all 当前场景 0 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[1], $branchIdList[0], $currentScene[0], $emptyMenu[0])) && p() && e('/,/场景6,/场景6/场景7,/场景6/场景7/场景8'); // 测试获取产品 1 模块 0 起始场景 6 分支 all 当前场景 0 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[1], $currentScene[0], $emptyMenu[0])) && p() && e('/,/场景1,/场景1/场景2,/场景3,/场景4,/场景5,/场景6,/场景6/场景7,/场景6/场景7/场景8,/场景9,/场景10'); // 测试获取产品 1 模块 0 起始场景 0 分支 '0' 当前场景 0 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[2], $currentScene[0], $emptyMenu[0])) && p() && e('/,/场景1,/场景1/场景2,/场景3,/场景4,/场景5,/场景6,/场景6/场景7,/场景6/场景7/场景8,/场景9,/场景10'); // 测试获取产品 1 模块 0 起始场景 0 分支 1 当前场景 0 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[0], $currentScene[1], $emptyMenu[0])) && p() && e('/,/场景1,/场景1/场景2,/场景3,/场景4,/场景5,/场景9,/场景10'); // 测试获取产品 1 模块 0 起始场景 0 分支 all 当前场景 6 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[0], $currentScene[0], $emptyMenu[1])) && p() && e('/,/场景1,/场景1/场景2,/场景3,/场景4,/场景5,/场景6,/场景6/场景7,/场景6/场景7/场景8,/场景9,/场景10,空'); // 测试获取产品 1 模块 0 起始场景 0 分支 all 当前场景 0 有空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[0], $moduleIdList[1], $sceneIdList[1], $branchIdList[1], $currentScene[1], $emptyMenu[0])) && p() && e('/,/场景7,/场景7/场景8'); // 测试获取产品 1 模块 1 起始场景 6 分支 '0' 当前场景 6 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[0], $moduleIdList[1], $sceneIdList[1], $branchIdList[1], $currentScene[1], $emptyMenu[0])) && p() && e('/,/场景7,/场景7/场景8'); // 测试获取产品 1 模块 1 起始场景 6 分支 '0' 当前场景 6 有空值 的场景数组
|
||||
|
||||
r($testcase->getSceneMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[0], $currentScene[0], $emptyMenu[0])) && p() && e('/,/场景11,/场景11/场景12,/场景11/场景12/场景13,/场景11/场景12/场景13/场景14,/场景11/场景15,/场景16,/场景16/场景17,/场景18,/场景18/场景19,/场景18/场景19/场景20'); // 测试获取产品 41 模块 0 起始场景 0 分支 all 当前场景 0 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[1], $moduleIdList[2], $sceneIdList[0], $branchIdList[0], $currentScene[0], $emptyMenu[0])) && p() && e('/,/场景16,/场景16/场景17,/场景18,/场景18/场景19,/场景18/场景19/场景20'); // 测试获取产品 41 模块 2 起始场景 0 分支 all 当前场景 0 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[2], $branchIdList[0], $currentScene[0], $emptyMenu[0])) && p() && e('/,/场景16,/场景16/场景17'); // 测试获取产品 41 模块 0 起始场景 6 分支 all 当前场景 0 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[2], $currentScene[0], $emptyMenu[0])) && p() && e('/,/分支1/场景16,/分支1/场景16/场景17,/分支1/场景18,/分支1/场景18/场景19,/分支1/场景18/场景19/场景20'); // 测试获取产品 41 模块 0 起始场景 0 分支 '0' 当前场景 0 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[2], $currentScene[0], $emptyMenu[0])) && p() && e('/,/分支1/场景16,/分支1/场景16/场景17,/分支1/场景18,/分支1/场景18/场景19,/分支1/场景18/场景19/场景20'); // 测试获取产品 41 模块 0 起始场景 0 分支 1 当前场景 0 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[0], $currentScene[2], $emptyMenu[0])) && p() && e('/,/场景11,/场景11/场景12,/场景11/场景12/场景13,/场景11/场景12/场景13/场景14,/场景11/场景15,/场景18,/场景18/场景19,/场景18/场景19/场景20'); // 测试获取产品 41 模块 0 起始场景 0 分支 all 当前场景 6 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[0], $currentScene[0], $emptyMenu[1])) && p() && e('/,/场景11,/场景11/场景12,/场景11/场景12/场景13,/场景11/场景12/场景13/场景14,/场景11/场景15,/场景16,/场景16/场景17,/场景18,/场景18/场景19,/场景18/场景19/场景20,空'); // 测试获取产品 41 模块 0 起始场景 0 分支 all 当前场景 0 有空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[1], $moduleIdList[2], $sceneIdList[2], $branchIdList[2], $currentScene[2], $emptyMenu[0])) && p() && e('/,/分支1/场景17'); // 测试获取产品 41 模块 2 起始场景 6 分支 '0' 当前场景 6 无空值 的场景数组
|
||||
r($testcase->getSceneMenuTest($productIdList[1], $moduleIdList[2], $sceneIdList[2], $branchIdList[2], $currentScene[2], $emptyMenu[0])) && p() && e('/,/分支1/场景17'); // 测试获取产品 41 模块 2 起始场景 6 分支 '0' 当前场景 6 有空值 的场景数组
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/testcase.class.php';
|
||||
|
||||
zdTable('scene')->config('modulescene')->gen('20');
|
||||
zdTable('user')->gen('1');
|
||||
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 testcaseModel->getScenesForMenu();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$productIdList = array(0, 1, 2);
|
||||
$moduleIdList = array(0, 1821, 1825);
|
||||
$sceneIdList = array(0, 1, 6);
|
||||
$branchIdList = array('all', '', '0');
|
||||
$currentScene = 1;
|
||||
|
||||
$testcase = new testcaseTest();
|
||||
|
||||
r($testcase->getScenesForMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[0])) && p() && e('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试获取产品 0 模块 0 起始场景 0 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[0])) && p() && e('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试获取产品 0 模块 0 起始场景 0 分支 all 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[1])) && p() && e('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试获取产品 0 模块 0 起始场景 0 分支 '' 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[2])) && p() && e('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试获取产品 0 模块 0 起始场景 0 分支 0 的场景
|
||||
|
||||
r($testcase->getScenesForMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[1])) && p() && e('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试获取产品 0 模块 0 起始场景 1 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[1], $branchIdList[2])) && p() && e('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试获取产品 0 模块 0 起始场景 1 分支 0 的场景
|
||||
|
||||
r($testcase->getScenesForMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[2])) && p() && e('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试获取产品 0 模块 0 起始场景 6 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[2], $branchIdList[2])) && p() && e('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试获取产品 0 模块 0 起始场景 6 分支 0 的场景
|
||||
|
||||
|
||||
r($testcase->getScenesForMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[0])) && p() && e('1,2,3,4'); // 测试获取产品 1 模块 0 起始场景 0 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[0])) && p() && e('1,2,3,4'); // 测试获取产品 1 模块 0 起始场景 0 分支 all 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[1])) && p() && e('1,2,3,4'); // 测试获取产品 1 模块 0 起始场景 0 分支 '' 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[2])) && p() && e('1,2,3,4'); // 测试获取产品 1 模块 0 起始场景 0 分支 0 的场景
|
||||
|
||||
r($testcase->getScenesForMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[1])) && p() && e('1,2,3,4'); // 测试获取产品 1 模块 0 起始场景 1 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[1], $branchIdList[2])) && p() && e('1,2,3,4'); // 测试获取产品 1 模块 0 起始场景 1 分支 0 的场景
|
||||
|
||||
r($testcase->getScenesForMenuTest($productIdList[1], $moduleIdList[1], $sceneIdList[1])) && p() && e('1'); // 测试获取产品 1 模块 1821 起始场景 1 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[1], $moduleIdList[1], $sceneIdList[1], $branchIdList[2])) && p() && e('1'); // 测试获取产品 1 模块 1821 起始场景 1 分支 0 的场景
|
||||
|
||||
|
||||
r($testcase->getScenesForMenuTest($productIdList[2], $moduleIdList[0], $sceneIdList[0])) && p() && e('5,6,7,8'); // 测试获取产品 2 模块 0 起始场景 0 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[2], $moduleIdList[0], $sceneIdList[0], $branchIdList[0])) && p() && e('5,6,7,8'); // 测试获取产品 2 模块 0 起始场景 0 分支 all 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[2], $moduleIdList[0], $sceneIdList[0], $branchIdList[1])) && p() && e('5,6,7,8'); // 测试获取产品 2 模块 0 起始场景 0 分支 '' 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[2], $moduleIdList[0], $sceneIdList[0], $branchIdList[2])) && p() && e('5,6,7,8'); // 测试获取产品 2 模块 0 起始场景 0 分支 0 的场景
|
||||
|
||||
r($testcase->getScenesForMenuTest($productIdList[2], $moduleIdList[0], $sceneIdList[1])) && p() && e('5,6,7,8'); // 测试获取产品 2 模块 0 起始场景 161 的场景
|
||||
r($testcase->getScenesForMenuTest($productIdList[2], $moduleIdList[0], $sceneIdList[1], $branchIdList[2])) && p() && e('5,6,7,8'); // 测试获取产品 2 模块 0 起始场景 161 分支 0 的场景
|
||||
|
||||
r($testcase->getScenesForMenuTest($productIdList[0], $moduleIdList[0], $sceneIdList[0], $branchIdList[2], $currentScene)) && p() && e('2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试获取产品 0 模块 0 起始场景 0 分支 0 的场景 排除 1
|
||||
r($testcase->getScenesForMenuTest($productIdList[1], $moduleIdList[0], $sceneIdList[0], $branchIdList[2], $currentScene)) && p() && e('2,3,4'); // 测试获取产品 1 模块 0 起始场景 0 分支 0 的场景 排除 1
|
||||
@@ -1374,21 +1374,22 @@ class testcaseTest
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试构建菜单查询。
|
||||
* Test build menu query.
|
||||
* 为构建场景菜单获取场景。
|
||||
* Get scenes for menu.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @param int $moduleID
|
||||
* @param int $startScene
|
||||
* @param string $branch
|
||||
* @param int $currentScene
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function buildMenuQueryTest(int $rootID, int $moduleID, int $startScene = 0, string $branch = 'all'): string
|
||||
public function getScenesForMenuTest(int $productID, int $moduleID, int $startScene = 0, string $branch = 'all', int $currentScene = 0): string
|
||||
{
|
||||
$query = $this->objectModel->buildMenuQuery($rootID, $moduleID, $startScene, $branch);
|
||||
$scenes = $this->objectModel->getScenesForMenu($productID, $moduleID, $startScene, $branch, $currentScene);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $query;
|
||||
return implode(',', array_keys($scenes));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1667,4 +1668,24 @@ class testcaseTest
|
||||
if(isset($scene['cases'])) $return .= ' cases: ' . implode(',', array_column($scene['cases'], 'id')) . '; ';
|
||||
return trim($return);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试获取场景菜单。
|
||||
* Test get scene menu.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $moduleID
|
||||
* @param int $startScene
|
||||
* @param int $branch
|
||||
* @param int $currentScene
|
||||
* @param bool $emptyMenu
|
||||
* @access public
|
||||
* @return array|string
|
||||
*/
|
||||
public function getSceneMenuTest(int $productID, int $moduleID, int $startScene = 0, int|string $branch = 0, int $currentScene = 0, bool $emptyMenu = false): array|string
|
||||
{
|
||||
$scenes = $this->objectModel->getSceneMenu($productID, $moduleID, $startScene, $branch, $currentScene, $emptyMenu);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return implode(',', $scenes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
title: table zt_scene
|
||||
desc: "用例"
|
||||
author: Mengyi Liu
|
||||
version: "1.0"
|
||||
fields:
|
||||
- field: id
|
||||
range: 1-1000
|
||||
- field: parent
|
||||
range: 0,1,0,0,0,0,6,7,0,0,0,11,12,13,11,0,16,0,18,19
|
||||
- field: title
|
||||
range: 1-1000
|
||||
prefix: 场景
|
||||
- field: product
|
||||
range: 1{10},41{10}
|
||||
- field: branch
|
||||
range: 0{15},1{5}
|
||||
- field: module
|
||||
range: 0{5},1{5},0{5},2{5}
|
||||
- field: grade
|
||||
range: 1,2,1{4},2,3,1{3},2,3,4,2,1,2,1,2,3
|
||||
- field: path
|
||||
fields:
|
||||
- field: path1
|
||||
range: 0{13},11,0{6}
|
||||
postfix: ","
|
||||
prefix: ","
|
||||
- field: path2
|
||||
range: 0{7},6,0{4},11,12,0{5},18
|
||||
postfix: ","
|
||||
- field: path3
|
||||
range: 0,1,0{4},6,7,0{3},11-13,11,0,16,0,18,19,
|
||||
postfix: ","
|
||||
- field: path4
|
||||
range: 1-20
|
||||
postfix: ","
|
||||
Reference in New Issue
Block a user