* [unittest] Fix program buildprogramactionsmap tao method test.

This commit is contained in:
wangyidong
2025-06-12 11:05:11 +08:00
parent 04c7ef5b0d
commit 3b10bb67df
2 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ class programTao extends programModel
*/
protected function buildProgramActionsMap(object $program): array
{
if($program->type == 'program' && !str_contains(",{$this->app->user->view->programs},", ",$program->id,")) return array();
if($program->type == 'program' && (!$this->app->user->admin || !str_contains(",{$this->app->user->view->programs},", ",{$program->id},"))) return array();
if($program->type == 'project') $this->loadModel('project');
$modelClass = '';
@@ -4,7 +4,13 @@ include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/program.unittest.class.php';
zenData('user')->gen(5);
zenData('project')->loadYaml('program')->gen(40);
$program = zenData('project')->loadYaml('program');
$program->type->range('program{2},project{3}');
$program->project->range('0{2},2{3}');
$program->model->range('``{2},scrum,waterfall,kanban');
$program->parent->range('0{2},2{3}');
$program->status->range('doing');
$program->gen(5)->fixPath();
su('admin');
/**
@@ -21,7 +27,7 @@ cid=1
*/
$objectIdList = array(1, 2, 11, 60, 100);
$objectIdList = array(1, 2, 3, 4, 5);
$programTester = new programTest();
r($programTester->buildProgramActionsMapTest($objectIdList[0])) && p('0:name') && e('close'); // 测试生成项目集id为1的操作按钮数据。