This commit is contained in:
songchenxuan
2022-01-18 11:30:46 +08:00
parent 2259cfc05b
commit 61900dd6cf
11 changed files with 220 additions and 4 deletions
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 projectModel::activate();
cid=1
pid=1
*/
class Tester
{
public function __construct($user)
{
global $tester;
su($user);
$this->project = $tester->loadModel('project');
}
/**
* checkStatus
*
* @param int $projectID
* @access public
* @return bool
*/
public function checkStatus($projectID)
{
$oldProject = $this->project->getById($projectID);
if($oldProject->status != 'closed') return false;
$change = $this->project->activate($projectID);
$project = $this->project->getById($projectID);
if($project->status != 'doing') return false;
return true;
}
}
$t = new Tester('admin');
/* Activate($projectID). */
r($t->checkStatus(66)) && p() && e('1'); //开始id为66状态不是closed的项目
r($t->checkStatus(67)) && p() && e('0'); //开始id为67状态是closed的项目
+8
View File
@@ -20,6 +20,13 @@ class Tester
$this->project = $tester->loadModel('project');
}
/**
* checkHasChildren
*
* @param int $projectID
* @access public
* @return bool
*/
public function checkHasChildren($projectID)
{
return $this->project->checkHasChildren($projectID);
@@ -28,5 +35,6 @@ class Tester
$t = new Tester('admin');
/* CheckHasChildren($projectID). */
r($t->checkHasChildren(1)) && p() && e('1'); //获取id为1的项目是否有子项目
r($t->checkHasChildren(101)) && p() && e('0'); //获取id为101的项目是否有子项目
+13 -4
View File
@@ -23,10 +23,17 @@ class Tester
$this->project = $tester->loadModel('project');
}
public function checkStatus($projectID, $realEnd)
/**
* checkStatus
*
* @param int $projectID
* @access public
* @return bool
*/
public function checkStatus($projectID)
{
$oldProject = $this->project->getById($projectID);
if($oldProject->status == 'closed') return false;
if($oldProject->status == 'suspended' or $oldProject->status == 'closed') return false;
$change = $this->project->close($projectID);
@@ -39,5 +46,7 @@ class Tester
$t = new Tester('admin');
r($t->checkStatus(20)) && p() && e('1'); //关闭一个状态不是closed的项目
r($t->checkStatus(26)) && p() && e('0'); //关闭一个状态是closed的项目
/* Close($projectID). */
r($t->checkStatus(20)) && p() && e('1'); //关闭id为20状态是closed的项目
r($t->checkStatus(26)) && p() && e('0'); //关闭id为26状态是closed的项目
r($t->checkStatus(41)) && p() && e('0'); //关闭id为41状态是suspended的项目
+9
View File
@@ -19,6 +19,14 @@ class Tester
su($user);
$this->project = $tester->loadModel('project');
}
/**
* checkBudgetUnitList
*
* @param string $checkList
* @access public
* @return bool
*/
public function checkBudgetUnitList($checkList = array('CNY' => '人民币', 'USD' => '美元'))
{
$budgetList = $this->project->getBudgetUnitList();
@@ -32,4 +40,5 @@ class Tester
$t = new Tester('admin');
/* GetBudgetUnitList(). */
r($t->checkBudgetUnitList()) && p() && e('1'); //检查翻译
+9
View File
@@ -21,6 +21,14 @@ class Tester
$this->project = $tester->loadModel('project');
}
/**
* getByIdList
*
* @param array $projectIdList
* @param int $count
* @access public
* @return array
*/
public function getByIdList($projectIdList, $count)
{
$projectList = $this->project->getByIdList($projectIdList);
@@ -32,4 +40,5 @@ class Tester
$t = new Tester('admin');
$projectIdList = array(11,12,13);
/* GetByIdList($projectIdList). */
r(($t->getByIdList($projectIdList, 3))) && p('11:name;12:name;13:name') && e('项目1;项目2;项目3'); //获取projectIdList对应的项目名称
+22
View File
@@ -20,6 +20,14 @@ class Tester
$this->project = $tester->loadModel('project');
}
/**
* getExecutionData
*
* @param int $projectID
* @param int $type
* @access public
* @return array
*/
public function getExecutionData($projectID, $type)
{
$result = $this->project->getDataByProject(TABLE_EXECUTION, $projectID, $type);
@@ -27,6 +35,13 @@ class Tester
return $result;
}
/**
* getBuildData
*
* @param int $projectID
* @access public
* @return array
*/
public function getBuildData($projectID)
{
$result = $this->project->getDataByProject(TABLE_BUILD, $projectID);
@@ -34,6 +49,13 @@ class Tester
return $result;
}
/**
* getRealseData
*
* @param int $projectID
* @access public
* @return array
*/
public function getRealseData($projectID)
{
$result = $this->project->getDataByProject(TABLE_RELEASE, $projectID);
+8
View File
@@ -20,6 +20,13 @@ class Tester
$this->project = $tester->loadModel('project');
}
/**
* getParentName
*
* @param int $projectID
* @access public
* @return array
*/
public function getParentName($projectID)
{
$program = $this->project->getParentName($projectID);
@@ -30,6 +37,7 @@ class Tester
$t = new Tester('admin');
/* GetParentName($projectID). */
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的项目父项目名字
+21
View File
@@ -20,6 +20,13 @@ class Tester
$this->project = $tester->loadModel('project');
}
/**
* getByStatus
*
* @param string $status
* @access public
* @return int
*/
public function getByStatus($status)
{
$executions = $this->project->getStats(0, $status);
@@ -34,6 +41,13 @@ class Tester
return count($executions);
}
/**
* getByProject
*
* @param int $projectID
* @access public
* @return int
*/
public function getByProject($projectID)
{
$executions = $this->project->getStats($projectID, 'all');
@@ -45,6 +59,13 @@ class Tester
return count($executions);
}
/**
* getListByOrder
*
* @param string $orderBy
* @access public
* @return bool
*/
public function getListByOrder($orderBy)
{
$executions = $this->project->getStats(0, 'all', 0, 0, 30, $orderBy);
@@ -23,6 +23,13 @@ class Tester
$this->project = $tester->loadModel('project');
}
/**
* getTeamMemberPairs
*
* @param int $projectID
* @access public
* @return int
*/
public function getTeamMemberPairs($projectID)
{
$members = array_filter($this->project->getTeamMemberPairs($projectID));
@@ -33,5 +40,6 @@ class Tester
$t = new Tester('admin');
/* GetTeamMemberPairs($projectID). */
r($t->getTeamMemberPairs(11)) && p() && e('2'); //获取id为11的项目团队成员个数
r($t->getTeamMemberPairs(1)) && p() && e('0'); //获取id为1的项目团队成员个数
+18
View File
@@ -23,6 +23,14 @@ class Tester
$this->project = $tester->loadModel('project');
}
/**
* checkMembers
*
* @param array $members
* @param array $users
* @access public
* @return bool
*/
public function checkMembers($members, $users)
{
foreach($users as $user)
@@ -32,6 +40,15 @@ class Tester
return true;
}
/**
* getTeamMembers
*
* @param int $projectID
* @param array $users
* @param bool $tutorial
* @access public
* @return int
*/
public function getTeamMembers($projectID, $users, $tutorial = false)
{
if($tutorial) define('TUTORIAL', true);
@@ -44,5 +61,6 @@ class Tester
$t = new Tester('admin');
/* GetTeamMembers($projectID). */
r($t->getTeamMembers(11, array('admin', 'pm92'))) && p() && e('2'); //获取id为11的项目团队成员个数
r($t->getTeamMembers(11, array('admin'), true)) && p() && e('1'); //获取id为11的项目团队成员个数,开启新手引导
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 projectModel::suspend();
cid=1
pid=1
*/
class Tester
{
public function __construct($user)
{
global $tester;
su($user);
$this->project = $tester->loadModel('project');
}
/**
* checkStatus
*
* @param int $projectID
* @access public
* @return bool
*/
public function checkStatus($projectID)
{
$oldProject = $this->project->getById($projectID);
if($oldProject->status == 'suspended' or $oldProject->status == 'closed') return false;
$change = $this->project->suspend($projectID);
$project = $this->project->getById($projectID);
if($project->status != 'suspended') return false;
return true;
}
}
$t = new Tester('admin');
/* Suspend($projectID). */
r($t->checkStatus(56)) && p() && e('1'); // 暂停id为56状态是doing的项目
r($t->checkStatus(73)) && p() && e('0'); // 暂停id为73状态是suspended的项目
r($t->checkStatus(74)) && p() && e('0'); // 暂停id为74状态是closed的项目