Files
EasySoft-ZenTaoPMS/test/model/program/settreepath.php
2022-01-18 10:41:40 +08:00

41 lines
808 B
PHP
Executable File

#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
class Tester
{
public function __construct($user)
{
global $tester;
su('admin');
$this->program = $tester->loadModel('program');
}
public function setTreePath($programID)
{
$programPath = $this->program->setTreePath($programID);
if($programPath)
{
return $this->program->getById($programID);
}
else
{
return 0;
}
}
}
$t = new Tester('admin');
/**
title=测试 programModel::setTreePath();
cid=1
pid=1
*/
r($t->setTreePath(12)) && p('path') && e('12,'); // 查找id=11的项目集的path
r($t->setTreePath(1000)) && p('path') && e('0'); // 查找不存在的id=1000的项目集的path