Files
EasySoft-ZenTaoPMS/test/model/programplan/getsiblings.php
2023-02-25 03:19:49 +00:00

44 lines
1.6 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/programplan.class.php';
zdTable('user')->gen(5);
su('admin');
$execution = zdTable('project');
$execution->id->range('1-5');
$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b');
$execution->type->range('project,stage{4}');
$execution->project->range('0,1{4}');
$execution->parent->range('0,1,2,3,1');
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
$execution->status->range('doing,doing,doing,closed,suspended');
$execution->openedBy->range('admin,user1');
$execution->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD');
$execution->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
$execution->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
$execution->gen(5);
/**
title=测试programplanModel->getSiblings();
cid=1
pid=1
测试id为2时获取兄弟阶段的的名称 >> 阶段b
测试id为2时获取自己兄弟阶段的个数 >> 1
测试id为4时获取自己兄弟阶段的个数 >> 0
*/
$plan = new programplanTest();
$topPlan = $plan->getSiblingsTest(2);
$topPlanCount = count($topPlan[2]);
$leafPlan = $plan->getSiblingsTest(4);
$leafPlanCount = count($leafPlan[4]);
r($topPlan[2][5]) && p('name') && e('阶段b'); // 测试id为2时获取兄弟阶段的的名称
r($topPlanCount - 1) && p('') && e(1); // 测试id为2时获取自己兄弟阶段的个数
r($leafPlanCount - 1) && p('') && e(0); // 测试id为4时获取自己兄弟阶段的个数