Merge branch 'mayue_add_autotest' into 'master'

* Add productplan autotest.

See merge request easycorp/zentaopms!3537
This commit is contained in:
孙广明
2022-05-20 01:43:17 +00:00
2 changed files with 40 additions and 0 deletions
+22
View File
@@ -179,6 +179,28 @@ class productPlan
return $productplans;
}
/**
* Get top plan pairs
*
* @param int $productID
* @param int $branch
* @param int $exclude
* @access public
* @return array
*/
public function getTopPlanPairsTest($param)
{
$productID = $param['productID'];
$branch = $param['branch'];
$exclude = $param['exclude'];
$planPairs = $this->productplan->getTopPlanPairs($productID, $branch, $exclude);
if(dao::isError()) return dao::getError();
return $planPairs;
}
/**
* Create
*
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/productplan.class.php';
$plan = new productPlan('admin');
$param = array();
$param[0] = array('productID' => 1, 'branch' => '', 'exclude' => '');
$param[1] = array('productID' => 1, 'branch' => '', 'exclude' => 1);
$param[2] = array('productID' => 41, 'branch' => 1, 'exclude' => '');
$param[3] = array('productID' => 41, 'branch' => 2, 'exclude' => '');
r($plan->getTopPlanPairsTest($param[0])) && p('1,2') && e('1.0,1.1'); //测试获取正常产品的顶级计划
r($plan->getTopPlanPairsTest($param[1])) && p('1,2') && e(',1.1'); //测试获取排除1.0计划的正常产品的顶级计划
r($plan->getTopPlanPairsTest($param[2])) && p('31') && e('1.0'); //测试获取分支1计划的正常产品的顶级计划
r($plan->getTopPlanPairsTest($param[3])) && p('32') && e('1.1'); //测试获取分支2计划的正常产品的顶级计划
?>