Merge branch 'autotest_denghongtao' into 'master'
add misc and productplan See merge request easycorp/zentaopms!2366
This commit is contained in:
60
test/class/misc.class.php
Normal file
60
test/class/misc.class.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
class Misc
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
su($user);
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
79
test/class/productplan.class.php
Normal file
79
test/class/productplan.class.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
class Productplan
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
su($user);
|
||||
$this->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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
9
test/model/misc/checkoneclickpackage.php
Executable file
9
test/model/misc/checkoneclickpackage.php
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/misc.class.php';
|
||||
|
||||
$misc = new Misc('admin');
|
||||
|
||||
r($misc->checkOneClickPackage()) && p() && e('');
|
||||
?>
|
||||
9
test/model/misc/getremind.php
Executable file
9
test/model/misc/getremind.php
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) .'/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) .'/class/misc.class.php';
|
||||
|
||||
$misc = new Misc('admin');
|
||||
|
||||
r($misc->getRemind()) && p() && e('0'); //调用方法返回值
|
||||
?>
|
||||
12
test/model/misc/gettableandstatus.php
Executable file
12
test/model/misc/gettableandstatus.php
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) .'/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) .'/class/misc.class.php';
|
||||
|
||||
$misc = new Misc('admin');
|
||||
|
||||
r($misc->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'); //这里测试传入不同参数||返回值相同
|
||||
?>
|
||||
9
test/model/misc/hello.php
Executable file
9
test/model/misc/hello.php
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/misc.class.php';
|
||||
|
||||
$misc = new Misc('admin');
|
||||
|
||||
r($misc->hello()) && p() && e('hello world from hello()<br />'); //简单打印,maybe test function。
|
||||
?>
|
||||
17
test/model/productplan/getbyidlist.php
Executable file
17
test/model/productplan/getbyidlist.php
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
|
||||
|
||||
$productplan = new Productplan('admin');
|
||||
|
||||
$IDlist = array();
|
||||
$IDlist[0] = 1;
|
||||
$IDlist[1] = 1000;
|
||||
$IDlist[2] = 3;
|
||||
|
||||
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'); //传入一个不存在的值返回布尔值
|
||||
?>
|
||||
16
test/model/productplan/getbyidplan.php
Executable file
16
test/model/productplan/getbyidplan.php
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
|
||||
|
||||
$productplan = new Productplan('admin');
|
||||
|
||||
$planID = array();
|
||||
$planID[0] = 5;
|
||||
$planID[1] = 1000;
|
||||
|
||||
r($productplan->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'); //如不存在,返回布尔值
|
||||
?>
|
||||
16
test/model/productplan/getlast.php
Executable file
16
test/model/productplan/getlast.php
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
|
||||
|
||||
$productplan = new Productplan('admin');
|
||||
|
||||
$getLast = array();
|
||||
$getLast[0] = 1;
|
||||
$getLast[1] = 2;
|
||||
$getLast[2] = 200;
|
||||
|
||||
r($productplan->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返回布尔值
|
||||
?>
|
||||
12
test/model/productplan/getlist.php
Executable file
12
test/model/productplan/getlist.php
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
|
||||
|
||||
$productplan = new Productplan('admin');
|
||||
|
||||
$List = array();
|
||||
$List[0] = 0;
|
||||
|
||||
r($productplan->getList(1, 0, 'all', null, 'begin_desc', 'kipparent')) && p('') && e('0'); //返回空数组
|
||||
?>
|
||||
8
test/model/productplan/getpairs.php
Executable file
8
test/model/productplan/getpairs.php
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
|
||||
|
||||
$productplan = new Productplan('admin');
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user