* Add program test.

This commit is contained in:
孙广明
2022-04-01 11:03:05 +08:00
parent f171cbf39d
commit c4a0eb47af
3 changed files with 13 additions and 53 deletions
-39
View File
@@ -50,45 +50,6 @@ class programTest
return $this->program->getStakeholdersByPrograms($programID);
}
/**
* getById
*
* @param iont mixed $programID
* @access public
* @return void
*/
public function getById($programID)
{
if(empty($this->program->getById($programID)))
{
return array('code' => 'fail', 'message' => 'Not Found');
}
else
{
return $this->program->getById($programID);
}
}
/**
* getChildren
*
* @param int mixed $programID
* @access public
* @return void
*/
public function getChildren($programID)
{
$programInfo = $this->program->getChildren($programID);
if(empty($programInfo))
{
return array('code' => 'fail' , 'message' => 'Not Found');
}
else
{
return $programInfo;
}
}
/**
* Test get list.
*
+6 -7
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/program.class.php';
su('admin');
/**
@@ -15,10 +15,9 @@ pid=1
*/
$SubprojectSet = new Program('admin');
global $tester;
$tester->loadModel('program');
$t_findnu = array('1', '22', '221');
r($SubprojectSet->getChildren($t_findnu[0])) && p() && e('9'); // 通过id查找id=1的子项目集个数
r($SubprojectSet->getChildren($t_findnu[1])) && p() && e('7'); // 通过id查找id=22的子项目集个数
r($SubprojectSet->getChildren($t_findnu[2])) && p('message') && e('Not Found'); // 通过id查找id=221的子项目集个数
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的子项目集个数
+7 -7
View File
@@ -1,9 +1,8 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/program.class.php';
su('dev1');
su('admin');
/**
@@ -16,9 +15,10 @@ pid=1
*/
$t = new Program('admin');
global $tester;
$tester->loadModel('program');
$top1 = $tester->program->getTopByID(1);
$top1000 = $tester->program->getTopByID(1000);
$program_id = array(1, 1000);
r($t->getByID3($program_id[0])) && p() && e('1'); //获取项目集1最上级的项目集id
r($t->getByID3($program_id[1])) && p() && e('Not Found'); //获取项目集1000最上级的项目集id
r($top1) && p() && e('1'); //获取项目集1最上级的项目集id
r($top1000) && p() && e('0'); //获取项目集1000最上级的项目集id