* Add unit test.
This commit is contained in:
@@ -118,4 +118,20 @@ class stageTest
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get a stage by id.
|
||||
*
|
||||
* @param string $projectType
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getTotalPercentTest($projectType)
|
||||
{
|
||||
$object = $this->objectModel->getTotalPercent($projectType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/stage.class.php';
|
||||
su('admin');
|
||||
|
||||
zdTable('stage')->gen(0);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 stageModel->batchCreate();
|
||||
@@ -28,8 +30,6 @@ pid=1
|
||||
测试批量创建融合瀑布项目的百分比超出100的阶段 >> 工作量占比累计不应当超过100%
|
||||
|
||||
*/
|
||||
zdTable('stage')->gen(0);
|
||||
|
||||
$name1 = array('1' => '批量创建的需求', '2' => '批量创建的设计', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => '');
|
||||
$percent1 = array('1' => '1', '2' => '2', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => '');
|
||||
$type1 = array('1' => 'request', '2' => 'design', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => '');
|
||||
|
||||
@@ -4,6 +4,8 @@ include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/stage.class.php';
|
||||
su('admin');
|
||||
|
||||
zdTable('stage')->gen(0);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 stageModel->create();
|
||||
@@ -37,8 +39,6 @@ pid=1
|
||||
|
||||
*/
|
||||
|
||||
zdTable('stage')->gen(0);
|
||||
|
||||
$stage1 = new stdclass();
|
||||
$stage1->name = '新建的需求';
|
||||
$stage1->percent = 1;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/stage.class.php';
|
||||
su('admin');
|
||||
|
||||
$stage = zdTable('stage');
|
||||
$stage->id->range('1-10');
|
||||
$stage->percent->range('10-20');
|
||||
$stage->projectType->range('waterfall{5}, waterfallplus{5}');
|
||||
$stage->deleted->range('0-1');
|
||||
$stage->gen(10);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 stageModel->getTotalPercent();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取瀑布项目的总百分比 >> 36
|
||||
测试获取融合瀑布项目的总百分比 >> 34
|
||||
|
||||
*/
|
||||
|
||||
$stage = new stageTest();
|
||||
|
||||
r($stage->getTotalPercentTest('waterfall')) && p() && e('36'); // 测试获取瀑布项目的总百分比
|
||||
r($stage->getTotalPercentTest('waterfallplus')) && p() && e('34'); // 测试获取融合瀑布项目的总百分比
|
||||
Reference in New Issue
Block a user