*Case.
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel::checkHasChildren();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
*/
|
||||
class Tester
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
su($user);
|
||||
$this->project = $tester->loadModel('project');
|
||||
}
|
||||
|
||||
public function checkHasChildren($projectID)
|
||||
{
|
||||
return $this->project->checkHasChildren($projectID);
|
||||
}
|
||||
}
|
||||
|
||||
$t = new Tester('admin');
|
||||
|
||||
r($t->checkHasChildren(1)) && p() && e('1'); //获取id为1的项目是否有子项目
|
||||
r($t->checkHasChildren(101)) && p() && e('0'); //获取id为101的项目是否有子项目
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel::close();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
class Tester
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
su($user);
|
||||
$this->project = $tester->loadModel('project');
|
||||
}
|
||||
|
||||
public function checkStatus($projectID, $realEnd)
|
||||
{
|
||||
$oldProject = $this->project->getById($projectID);
|
||||
if($oldProject->status == 'closed') return false;
|
||||
|
||||
$change = $this->project->close($projectID);
|
||||
|
||||
$project = $this->project->getById($projectID);
|
||||
if($project->status != 'closed') return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$t = new Tester('admin');
|
||||
|
||||
r($t->checkStatus(20)) && p() && e('1'); //关闭一个状态不是closed的项目
|
||||
r($t->checkStatus(26)) && p() && e('0'); //关闭一个状态是closed的项目
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel::getBudgetUnitList();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
*/
|
||||
class Tester
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
su($user);
|
||||
$this->project = $tester->loadModel('project');
|
||||
}
|
||||
public function checkBudgetUnitList($checkList = array('CNY' => '人民币', 'USD' => '美元'))
|
||||
{
|
||||
$budgetList = $this->project->getBudgetUnitList();
|
||||
foreach($budgetList as $enBudget => $zhBudget)
|
||||
{
|
||||
if($checkList[$enBudget] != $zhBudget) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$t = new Tester('admin');
|
||||
|
||||
r($t->checkBudgetUnitList()) && p() && e('1'); //检查翻译
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel::getByIdList();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
*/
|
||||
class Tester
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
su($user);
|
||||
$this->project = $tester->loadModel('project');
|
||||
}
|
||||
|
||||
public function getByIdList($projectIdList, $count)
|
||||
{
|
||||
$projectList = $this->project->getByIdList($projectIdList);
|
||||
if(count($projectList) != $count) return false;
|
||||
return $projectList;
|
||||
}
|
||||
}
|
||||
|
||||
$t = new Tester('admin');
|
||||
$projectIdList = array(11,12,13);
|
||||
|
||||
r(($t->getByIdList($projectIdList, 3))) && p('11:name;12:name;13:name') && e('项目1;项目2;项目3'); //获取projectIdList对应的项目名称
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel::getDataByProject();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
*/
|
||||
class Tester
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
su($user);
|
||||
$this->project = $tester->loadModel('project');
|
||||
}
|
||||
|
||||
public function getExecutionData($projectID, $type)
|
||||
{
|
||||
$result = $this->project->getDataByProject(TABLE_EXECUTION, $projectID, $type);
|
||||
if(empty($result)) return false;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getBuildData($projectID)
|
||||
{
|
||||
$result = $this->project->getDataByProject(TABLE_BUILD, $projectID);
|
||||
if(empty($result)) return false;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getRealseData($projectID)
|
||||
{
|
||||
$result = $this->project->getDataByProject(TABLE_RELEASE, $projectID);
|
||||
if(empty($result)) return false;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/* 还有case bug testtask doc表 */
|
||||
$t = new Tester();
|
||||
|
||||
/* GetDataByProject(TABLE_EXECUTION, $projectID, $type). */
|
||||
r($t->getExecutionData(39)) && p('id') && e('129'); //获取parent为11首个项目的id
|
||||
r($t->getExecutionData(40, 'sprint')) && p('id') && e('130'); //获取parent为11的首个项目的id
|
||||
r($t->getExecutionData(41, 'stage')) && p('id') && e('131'); //获取parent为11的首个项目的id
|
||||
r($t->getExecutionData(10000)) && p('id') && e('0'); //获取parent为10000的首个项目的id
|
||||
|
||||
/* GetDataByProject(TABLE_BUILD, $projectID, $type). */
|
||||
r($t->getBuildData(131)) && p('id') && e('1'); //获取parent为131的首个版本的id
|
||||
r($t->getBuildData(132)) && p('id') && e('6'); //获取parent为132的首个版本的id
|
||||
r($t->getBuildData(10000)) && p('id') && e('0'); //获取parent为10000的首个版本的id
|
||||
|
||||
/* GetDataByProject(TABLE_EXECUTION, $projectID, $type). */
|
||||
r($t->getRealseData(131)) && p('id') && e('1'); //获取parent为132的首个发布的id
|
||||
r($t->getRealseData(132)) && p('id') && e('6'); //获取parent为132的首个发布的id
|
||||
r($t->getRealseData(10000)) && p('id') && e('0'); //获取parent为10000的首个发布的id
|
||||
|
||||
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel::getParentName();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
*/
|
||||
class Tester
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
su($user);
|
||||
$this->project = $tester->loadModel('project');
|
||||
}
|
||||
|
||||
public function getParentName($projectID)
|
||||
{
|
||||
$program = $this->project->getParentName($projectID);
|
||||
if(empty($program)) return false;
|
||||
return $program;
|
||||
}
|
||||
}
|
||||
|
||||
$t = new Tester('admin');
|
||||
|
||||
r($t->getParentName(11)) && p('name') && e('项目集1'); //获取id为11的项目父项目名字
|
||||
r($t->getParentName(1)) && p('name') && e('项目集1'); //获取id为1的项目父项目名字
|
||||
r($t->getParentName(0)) && p('name') && e('0'); //获取id为0的项目父项目名字
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel::getStats();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
*/
|
||||
class Tester
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
su($user);
|
||||
$this->project = $tester->loadModel('project');
|
||||
}
|
||||
|
||||
public function getByStatus($status)
|
||||
{
|
||||
$executions = $this->project->getStats(0, $status);
|
||||
if(empty($executions)) return false;
|
||||
if($status != 'all')
|
||||
{
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
if($execution->status != $status) return false;
|
||||
}
|
||||
}
|
||||
return count($executions);
|
||||
}
|
||||
|
||||
public function getByProject($projectID)
|
||||
{
|
||||
$executions = $this->project->getStats($projectID, 'all');
|
||||
if(empty($executions)) return false;
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
if($execution->project != $projectID) return false;
|
||||
}
|
||||
return count($executions);
|
||||
}
|
||||
|
||||
public function getListByOrder($orderBy)
|
||||
{
|
||||
$executions = $this->project->getStats(0, 'all', 0, 0, 30, $orderBy);
|
||||
return checkOrder($executions, $orderBy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$t = new Tester('admin');
|
||||
|
||||
/* GetStats(0, $status). */
|
||||
r($t->getByStatus('all')) && p() && e('600'); //查看所有执行
|
||||
r($t->getByStatus('undone')) && p() && e('0'); //查看未完成的执行
|
||||
r($t->getByStatus('doing')) && p() && e('300'); //查看所有进行中的执行
|
||||
r($t->getByStatus('wait')) && p() && e('300'); //查看所有进行中的执行
|
||||
|
||||
/* GetStats($projectID, 'all'). */
|
||||
r($t->getByProject('11')) && p() && e('7'); //查看id为11项目的执行
|
||||
r($t->getByProject('12')) && p() && e('7'); //查看id为11项目的执行
|
||||
|
||||
/* GetStats(0, 'all', 0, 0, 30, $orderBy). */
|
||||
r($t->getListByOrder(0, 'all', 0, 0, 30, 'id_desc')) && p() && e('1'); //按照项目id倒序获取项目列表
|
||||
r($t->getListByOrder(0, 'all', 0, 0, 30, 'name_asc')) && p() && e('1'); //按照项目名称正序获取项目列表
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel::getTeamMembers();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
*/
|
||||
|
||||
class Tester
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
su('admin');
|
||||
$this->project = $tester->loadModel('project');
|
||||
}
|
||||
|
||||
public function getTeamMemberPairs($projectID)
|
||||
{
|
||||
$members = array_filter($this->project->getTeamMemberPairs($projectID));
|
||||
if(empty($members)) return false;
|
||||
return count($members);
|
||||
}
|
||||
}
|
||||
|
||||
$t = new Tester('admin');
|
||||
|
||||
r($t->getTeamMemberPairs(11)) && p() && e('2'); //获取id为11的项目团队成员个数
|
||||
r($t->getTeamMemberPairs(1)) && p() && e('0'); //获取id为1的项目团队成员个数
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel::getTeamMembers();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
*/
|
||||
|
||||
class Tester
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
su($user);
|
||||
$this->project = $tester->loadModel('project');
|
||||
}
|
||||
|
||||
public function checkMembers($members, $users)
|
||||
{
|
||||
foreach($users as $user)
|
||||
{
|
||||
if(!isset($members[$user])) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getTeamMembers($projectID, $users, $tutorial = false)
|
||||
{
|
||||
if($tutorial) define('TUTORIAL', true);
|
||||
$members = $this->project->getTeamMembers($projectID);
|
||||
if(empty($members)) return false;
|
||||
if(!empty($users)) $this->checkMembers($members, $users);
|
||||
return count($members);
|
||||
}
|
||||
}
|
||||
|
||||
$t = new Tester('admin');
|
||||
|
||||
r($t->getTeamMembers(11, array('admin', 'pm92'))) && p() && e('2'); //获取id为11的项目团队成员个数
|
||||
r($t->getTeamMembers(11, array('admin'), true)) && p() && e('1'); //获取id为11的项目团队成员个数,开启新手引导
|
||||
Reference in New Issue
Block a user