* Refactor myModel::buildTaskSearchForm, and modify its unit test.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The control file of dashboard module of ZenTaoPMS.
|
||||
*
|
||||
|
||||
+3
-1
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The model file of dashboard module of ZenTaoPMS.
|
||||
*
|
||||
@@ -474,6 +475,7 @@ class myModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建任务搜索表单。
|
||||
* Build search form for task page of work.
|
||||
*
|
||||
* @param int $queryID
|
||||
@@ -481,7 +483,7 @@ class myModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function buildTaskSearchForm($queryID, $actionURL)
|
||||
public function buildTaskSearchForm(int $queryID, string $actionURL): void
|
||||
{
|
||||
$rawMethod = $this->app->rawMethod;
|
||||
$this->loadModel('execution');
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/my.class.php';
|
||||
|
||||
zdTable('user')->gen('1');
|
||||
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 myModel->buildTaskSearchForm();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
$my = new myTest();
|
||||
|
||||
$queryID = array(0, 1);
|
||||
$actionURL = array('actionURL1', 'actionURL2');
|
||||
$config1 = $my->buildTaskSearchFormTest($queryID[0], $actionURL[0]);
|
||||
$config2 = $my->buildTaskSearchFormTest($queryID[1], $actionURL[1]);
|
||||
r($config1) && p('module,queryID,actionURL') && e('Task,0,actionURL1'); // 测试获取queryID 1 actionURL actionURL1 的搜索表单
|
||||
r($config2) && p('module,queryID,actionURL') && e('Task,1,actionURL2'); // 测试获取queryID 0 actionURL actionURL2 的搜索表单
|
||||
@@ -260,4 +260,22 @@ class myTest
|
||||
global $tester;
|
||||
return $tester->config->testcase->search;
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试构建任务搜索表单。
|
||||
* Test build task search form.
|
||||
*
|
||||
* @param int $queryID
|
||||
* @param string $actionURL
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function buildTaskSearchFormTest(int $queryID, string $actionURL): array
|
||||
{
|
||||
$this->objectModel->buildTaskSearchForm($queryID, $actionURL);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
global $tester;
|
||||
return $tester->config->execution->search;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user