From 15799d29aa1262982a34fe882fdc77682627178a Mon Sep 17 00:00:00 2001 From: denghongtao <[denghongtao@easycorp.ltd]> Date: Fri, 18 Mar 2022 11:14:36 +0800 Subject: [PATCH 1/4] add misc and productplan --- test/class/misc.class.php | 60 ++++++++++++++++++ test/class/productplan.class.php | 79 ++++++++++++++++++++++++ test/model/misc/checkoneclickpackage.php | 9 +++ test/model/misc/getremind.php | 9 +++ test/model/misc/gettableandstatus.php | 12 ++++ test/model/misc/hello.php | 9 +++ test/model/productplan/getbyidlist.php | 19 ++++++ test/model/productplan/getbyidplan.php | 16 +++++ test/model/productplan/getlast.php | 16 +++++ test/model/productplan/getlist.php | 13 ++++ test/model/productplan/getpairs.php | 9 +++ 11 files changed, 251 insertions(+) create mode 100644 test/class/misc.class.php create mode 100644 test/class/productplan.class.php create mode 100755 test/model/misc/checkoneclickpackage.php create mode 100755 test/model/misc/getremind.php create mode 100755 test/model/misc/gettableandstatus.php create mode 100755 test/model/misc/hello.php create mode 100755 test/model/productplan/getbyidlist.php create mode 100755 test/model/productplan/getbyidplan.php create mode 100755 test/model/productplan/getlast.php create mode 100755 test/model/productplan/getlist.php create mode 100755 test/model/productplan/getpairs.php diff --git a/test/class/misc.class.php b/test/class/misc.class.php new file mode 100644 index 0000000000..1346917bc0 --- /dev/null +++ b/test/class/misc.class.php @@ -0,0 +1,60 @@ +misc = $tester->loadModel('misc'); + } + + /** + * hello + * + * @access public + * @return void + */ + public function hello() + { + $miscs = $this->misc->hello(); + return $miscs; + } + + /** + * getTableAndStatus + * 传入参数来获取表状态 + * @param string $type + * @access public + * @return void + */ + public function getTableAndStatus($type = 'check') + { + $miscs = $this->misc->getTableAndStatus($type = 'check'); + return $miscs; + } + + /** + * getRemind + * + * @access public + * @return void + */ + public function getRemind() + { + $miscs = $this->misc->getRemind(); + return $miscs; + } + + /** + * checkOneClickPackage + * + * @access public + * @return void + */ + public function checkOneClickPackage() + { + $miscs = $this->misc->checkOneClickPackage(); + return $miscs; + } +} +?> diff --git a/test/class/productplan.class.php b/test/class/productplan.class.php new file mode 100644 index 0000000000..dbc5f8cbd0 --- /dev/null +++ b/test/class/productplan.class.php @@ -0,0 +1,79 @@ +productplan = $tester->loadModel('productplan'); + } + + /** + * getByIDPlan + * + * @param int mixed $planID + * @param bool mixed $setImgSize + * @access public + * @return void + */ + public function getByIDPlan($planID, $setImgSize = false) + { + $productplans = $this->productplan->getByID($planID, $setImgSize = false); + return $productplans; + } + + /** + * getByIDList + * + * @param array(int) mixed $planIDList + * @access public + * @return void + */ + public function getByIDList($planIDList) + { + $productplans = $this->productplan->getByIDList($planIDList); + return $productplans; + } + + /** + * getLast + * + * @param int mixed $productID + * @param int $branch + * @param int $parent + * @access public + * @return void + */ + public function getLast($productID, $branch = 0, $parent = 0) + { + $productplans = $this->productplan->getLast($productID, $branch = 0, $parent = 0); + return $productplans; + } + + /** + * getList + * + * @param int $product + * @param int $branch + * @param string $browseType + * @param mixed $pager + * @param string $orderBy + * @param string $param + * @access public + * @return void + */ + public function getList($product = 0, $branch = 0, $browseType = 'doing', $pager = null, $orderBy = 'begin_desc', $param = '') + { + $productplans = $this->productplan->getList($product = 0, $branch = 0, $browseType = 'doing', $pager = null, $orderBy = 'begin_desc', $param = ''); + return $productplans; + } + + public function getPairs($product = 0, $branch = '', $expired = '', $skipParent = false) + { + $productplans = $this->productplan->getPairs($product = 0, $branch = '', $expired = '', $skipParent = false); + return $productplans; + } + +} + +?> diff --git a/test/model/misc/checkoneclickpackage.php b/test/model/misc/checkoneclickpackage.php new file mode 100755 index 0000000000..e0530d012b --- /dev/null +++ b/test/model/misc/checkoneclickpackage.php @@ -0,0 +1,9 @@ +#!/usr/bin/env php +checkOneClickPackage()) && p() && e(''); +?> diff --git a/test/model/misc/getremind.php b/test/model/misc/getremind.php new file mode 100755 index 0000000000..4293172f90 --- /dev/null +++ b/test/model/misc/getremind.php @@ -0,0 +1,9 @@ +#!/usr/bin/env php +getRemind()) && p() && e('0'); //调用方法返回值 +?> diff --git a/test/model/misc/gettableandstatus.php b/test/model/misc/gettableandstatus.php new file mode 100755 index 0000000000..b8e5a7e54a --- /dev/null +++ b/test/model/misc/gettableandstatus.php @@ -0,0 +1,12 @@ +#!/usr/bin/env php +getTableAndStatus('check')) && p('zt_account') && e('ok'); //输入表名,查看数据库表状态使用情况等,正常输出ok +r($misc->getTableAndStatus('check')) && p('zt_zoutput') && e('ok'); //如被占用返回:1 client is using or hasn't closed the table properly(由于动态更新,此处断言两张表正常状态) +r($misc->getTableAndStatus('repair')) && p('zt_webhook') && e('ok'); //可以传入repair参数,状态与上述一致 +r($misc->getTableAndStatus('aaaaa')) && p('zt_account') && e('ok'); //这里测试传入不同参数||返回值相同 +?> diff --git a/test/model/misc/hello.php b/test/model/misc/hello.php new file mode 100755 index 0000000000..3e1fea7acf --- /dev/null +++ b/test/model/misc/hello.php @@ -0,0 +1,9 @@ +#!/usr/bin/env php +hello()) && p() && e('hello world from hello()
'); //简单打印,maybe test function。 +?> diff --git a/test/model/productplan/getbyidlist.php b/test/model/productplan/getbyidlist.php new file mode 100755 index 0000000000..9d06c2dcd0 --- /dev/null +++ b/test/model/productplan/getbyidlist.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getByIDList($IDlist));die; + +r($productplan->getByIDList($IDlist)) && p('3:id') && e('3'); //传入一个数组,取值id为3的数据 +r($productplan->getByIDList($IDlist)) && p('1:id') && e('1'); //传入一个数组,取值id为1的数据 +r($productplan->getByIDList($IDlist[0])) && p('1:id') && e('1'); //传入一个数值,正常取值 +r($productplan->getByIDList($IDlist[1])) && p() && e('0'); //传入一个不存在的值返回布尔值 +?> diff --git a/test/model/productplan/getbyidplan.php b/test/model/productplan/getbyidplan.php new file mode 100755 index 0000000000..3303c95f2b --- /dev/null +++ b/test/model/productplan/getbyidplan.php @@ -0,0 +1,16 @@ +#!/usr/bin/env php +getByIDPlan($planID[0])) && p('status') && e('wait'); //如果存在,返回数组类型数据 +r($productplan->getByIDPlan($planID[0])) && p('begin') && e('2021-06-13'); //取出开始时间 +r($productplan->getByIDPlan($planID[0])) && p('end') && e('2021-10-14'); //取出结束时间 +r($productplan->getByIDPlan($planID[1])) && p() && e('0'); //如不存在,返回布尔值 +?> diff --git a/test/model/productplan/getlast.php b/test/model/productplan/getlast.php new file mode 100755 index 0000000000..ce1970c467 --- /dev/null +++ b/test/model/productplan/getlast.php @@ -0,0 +1,16 @@ +#!/usr/bin/env php +getLast($getLast[0])) && p('id') && e('3'); //获取id为1的最后一个产品 +r($productplan->getLast($getLast[1])) && p('id') && e('6'); //获取id为2的最后一个产品 +r($productplan->getLast($getLast[2])) && p('id') && e('0'); //获取不存在的id返回布尔值 +?> diff --git a/test/model/productplan/getlist.php b/test/model/productplan/getlist.php new file mode 100755 index 0000000000..aa32b99758 --- /dev/null +++ b/test/model/productplan/getlist.php @@ -0,0 +1,13 @@ +#!/usr/bin/env php +getList(1, 0, 'all', null, 'begin_desc', 'kipparent'));die; +r($productplan->getList(1, 0, 'all', null, 'begin_desc', 'kipparent')) && p('') && e('0'); //返回空数组 +?> diff --git a/test/model/productplan/getpairs.php b/test/model/productplan/getpairs.php new file mode 100755 index 0000000000..e2372a7e52 --- /dev/null +++ b/test/model/productplan/getpairs.php @@ -0,0 +1,9 @@ +#!/usr/bin/env php +getPairs($product = array(28, 29, 30), $branch = '1', $expired = '', $skipParent = false));die; +?> From c9904a1eae874480bbb14b25c5cdce4e9432cc9e Mon Sep 17 00:00:00 2001 From: denghongtao <[denghongtao@easycorp.ltd]> Date: Fri, 18 Mar 2022 11:31:33 +0800 Subject: [PATCH 2/4] change getpairs.php.die; --- test/model/productplan/getpairs.php | 1 - 1 file changed, 1 deletion(-) diff --git a/test/model/productplan/getpairs.php b/test/model/productplan/getpairs.php index e2372a7e52..98952f86e4 100755 --- a/test/model/productplan/getpairs.php +++ b/test/model/productplan/getpairs.php @@ -5,5 +5,4 @@ include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php'; $productplan = new Productplan('admin'); -var_dump($productplan->getPairs($product = array(28, 29, 30), $branch = '1', $expired = '', $skipParent = false));die; ?> From 071c930bec7666c26d3b0fed474fcbe569da93cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Fri, 18 Mar 2022 05:15:13 +0000 Subject: [PATCH 3/4] Update getbyidlist.php --- test/model/productplan/getbyidlist.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/model/productplan/getbyidlist.php b/test/model/productplan/getbyidlist.php index 9d06c2dcd0..41047865e6 100755 --- a/test/model/productplan/getbyidlist.php +++ b/test/model/productplan/getbyidlist.php @@ -10,8 +10,6 @@ $IDlist[0] = 1; $IDlist[1] = 1000; $IDlist[2] = 3; -//var_dump($productplan->getByIDList($IDlist));die; - r($productplan->getByIDList($IDlist)) && p('3:id') && e('3'); //传入一个数组,取值id为3的数据 r($productplan->getByIDList($IDlist)) && p('1:id') && e('1'); //传入一个数组,取值id为1的数据 r($productplan->getByIDList($IDlist[0])) && p('1:id') && e('1'); //传入一个数值,正常取值 From 21d6c27a4b63db388fb7e8afe1be6a982637a620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Fri, 18 Mar 2022 05:15:30 +0000 Subject: [PATCH 4/4] Update getlist.php --- test/model/productplan/getlist.php | 1 - 1 file changed, 1 deletion(-) diff --git a/test/model/productplan/getlist.php b/test/model/productplan/getlist.php index aa32b99758..321dd8833b 100755 --- a/test/model/productplan/getlist.php +++ b/test/model/productplan/getlist.php @@ -8,6 +8,5 @@ $productplan = new Productplan('admin'); $List = array(); $List[0] = 0; -//var_dump($productplan->getList(1, 0, 'all', null, 'begin_desc', 'kipparent'));die; r($productplan->getList(1, 0, 'all', null, 'begin_desc', 'kipparent')) && p('') && e('0'); //返回空数组 ?>