diff --git a/module/my/model.php b/module/my/model.php index c9d85836ac..126d8c4a65 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -701,15 +701,15 @@ class myModel extends model } /** + * 构建需求搜索表单。 * Build Story search form. * * @param int $queryID * @param string $actionURL - * @param string $type * @access public * @return void */ - public function buildStorySearchForm($queryID, $actionURL, $type) + public function buildStorySearchForm(int $queryID, string $actionURL): void { $products = $this->dao->select('id,name')->from(TABLE_PRODUCT) ->where('deleted')->eq(0) diff --git a/module/my/test/model/buildstorysearchform.php b/module/my/test/model/buildstorysearchform.php new file mode 100644 index 0000000000..1723f0c83c --- /dev/null +++ b/module/my/test/model/buildstorysearchform.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +gen('1'); + +su('admin'); + +/** + +title=测试 myModel->buildStorySearchForm(); +cid=1 +pid=1 + +*/ + +$my = new myTest(); + +$queryID = array(0, 1); +$actionURL = array('actionURL1', 'actionURL2'); +$config1 = $my->buildStorySearchFormTest($queryID[0], $actionURL[0]); +$config2 = $my->buildStorySearchFormTest($queryID[1], $actionURL[1]); +r($config1) && p('module,queryID,actionURL') && e('storyStory,0,actionURL1'); // 测试获取queryID 1 actionURL actionURL1 的搜索表单 +r($config2) && p('module,queryID,actionURL') && e('storyStory,1,actionURL2'); // 测试获取queryID 0 actionURL actionURL2 的搜索表单 diff --git a/module/my/test/my.class.php b/module/my/test/my.class.php index 826eecb29e..b24002a48f 100644 --- a/module/my/test/my.class.php +++ b/module/my/test/my.class.php @@ -329,4 +329,24 @@ class myTest return array_keys($objects); } + + /** + * 测试构建需求搜索表单。 + * Test build story search form. + * + * @param int $queryID + * @param string $actionURL + * @access public + * @return array + */ + public function buildStorySearchFormTest(int $queryID, string $actionURL): array + { + global $tester; + $tester->app->rawModule = 'my'; + $tester->app->rawMethod = 'story'; + $this->objectModel->buildStorySearchForm($queryID, $actionURL); + + if(dao::isError()) return dao::getError(); + return $tester->config->product->search; + } }