Merge branch 'sprint/tsj_uinttest' of https://gitlab.zcorp.cc/easycorp/zentaopms into sprint/tsj_uinttest

This commit is contained in:
caoyanyi
2023-01-05 14:08:56 +08:00
3 changed files with 29 additions and 27 deletions
+12
View File
@@ -149,4 +149,16 @@ class programTest
return $program;
}
/**
* Get children.
*
* @param int $programID
* @access public
* @return int
*/
public function getChildrenTest($programID)
{
return $this->program->getChildren($programID);
}
}
-19
View File
@@ -1,19 +0,0 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 programModel::getBudgetUnitList();
cid=1
pid=1
获取货币类型列表 >> 人民币;美元
*/
global $tester;
$tester->loadModel('project');
r($tester->loadModel('program')->getBudgetUnitList()) && p('CNY;USD') && e('人民币;美元'); //获取货币类型列表
+17 -8
View File
@@ -1,23 +1,32 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/program.class.php';
su('admin');
$program = zdTable('project');
$program->id->range('1-3');
$program->name->range('父项目集1,子项目集1,子项目集2');
$program->parent->range('0,1,1');
$program->type->range('program');
$program->path->setFields(array(
array('field' => 'path1', 'range' => '1', 'prefix' => ',', 'postfix' => ','),
array('field' => 'path2', 'range' => '[],2,3', 'postfix' => ',')
));
$program->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD');
$program->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
$program->gen(3);
/**
title=测试 programModel:: getChildren();
cid=1
pid=1
通过id查找id=1的子项目集个数 >> 9
通过id查找id=22的子项目集个数 >> 7
通过id查找id=221的子项目集个数 >> 0
通过id查找id=1的子项目集个数 >> 2
*/
global $tester;
$tester->loadModel('program');
$programTester = new programTest();
r($tester->program->getChildren(1)) && p() && e('9'); // 通过id查找id=1的子项目集个数
r($tester->program->getChildren(22)) && p() && e('7'); // 通过id查找id=22的子项目集个数
r($tester->program->getChildren(221)) && p() && e('0'); // 通过id查找id=221的子项目集个数
r($programTester->getChildrenTest(1)) && p() && e('2'); // 通过id查找id=1的子项目集个数