diff --git a/test/class/program.class.php b/test/class/program.class.php index 4551f246e7..20cb41b8e4 100644 --- a/test/class/program.class.php +++ b/test/class/program.class.php @@ -134,4 +134,19 @@ class programTest return $budget; } + + /** + * Set tree path. + * + * @param int $programID + * @access public + * @return void + */ + public function setTreePathTest($programID) + { + $this->program->setTreePath($programID); + $program = $this->program->getByID($programID); + + return $program; + } } diff --git a/test/lib/yaml.class.php b/test/lib/yaml.class.php index 2ce3f4ad97..a43dc5e9af 100644 --- a/test/lib/yaml.class.php +++ b/test/lib/yaml.class.php @@ -257,7 +257,7 @@ class yaml * @access public * @return void */ - public function gen($rows, $version = '') + public function gen($rows, $version = '1.0') { $runFileDir = dirname(getcwd() . DS . $_SERVER['SCRIPT_FILENAME']); $runFileName = str_replace(strrchr($_SERVER['SCRIPT_FILENAME'], "."), "", $_SERVER['SCRIPT_FILENAME']); @@ -268,9 +268,9 @@ class yaml $yamlDataArr = array(); - $yamlDataArr['title'] = "zt_{$this->tableName}"; - $yamlDataArr['author'] = "auto_{$runFileName}"; - $version ? $yamlDataArr['version'] = $version : $yamlDataArr['version'] = '1.0'; + $yamlDataArr['title'] = "zt_{$this->tableName}"; + $yamlDataArr['author'] = "auto_{$runFileName}"; + $yamlDataArr['version'] = $version; if(empty($this->fields->fieldArr)) { diff --git a/test/model/program/settreepath.php b/test/model/program/settreepath.php index 689014342c..76b79722ac 100755 --- a/test/model/program/settreepath.php +++ b/test/model/program/settreepath.php @@ -1,26 +1,34 @@ #!/usr/bin/env php id->range('1,10'); +$program->name->range('项目集1'); +$program->type->range('program'); +$program->parent->range('[],[1]'); +$program->path->range('1,10')->prefix(',')->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(2); + /** title=测试 programModel::setTreePath(); cid=1 pid=1 -设置之前的项目集的path >> ,2,12, -设置之后的项目集的path >> ,2,12, +设置之前的项目集的path >> ,10, +设置之后的项目集的path >> ,1,10, */ -global $tester; -$tester->loadModel('program'); +$programTester = new programTest(); -$before = $tester->program->getById(12); -$tester->program->setTreePath(12); -$after = $tester->program->getById(12); +$before = $programTester->getByIDTest(10); +$after = $programTester->setTreePathTest(10); -r($before) && p('path') && e(',2,12,'); // 设置之前的项目集的path -r($after) && p('path') && e(',2,12,'); // 设置之后的项目集的path -$db->restoreDB(); \ No newline at end of file +r($before) && p('path') && e(',10,'); // 设置之前的项目集的path +r($after) && p('path') && e(',1,10,'); // 设置之后的项目集的path