+ Move unit test from test directory to each module.
This commit is contained in:
@@ -0,0 +1,590 @@
|
||||
<?php
|
||||
class actionTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('action');
|
||||
$tester->dao->delete()->from(TABLE_ACTION)->where('action')->eq('login')->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a action.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param string $actionType
|
||||
* @param string $comment
|
||||
* @param string $extra
|
||||
* @param string $actor
|
||||
* @param bool $autoDelete
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createTest($objectType, $objectID, $actionType, $comment = '', $extra = '', $actor = '', $autoDelete = true)
|
||||
{
|
||||
$_SERVER['HTTP_HOST'] = 'pms.zentao.com';
|
||||
$_POST['uid'] = '';
|
||||
$objectID = $this->objectModel->create($objectType, $objectID, $actionType, $comment, $extra, $actor, $autoDelete);
|
||||
|
||||
unset($_POST);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objectID ? $this->objectModel->getById($objectID) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update read field of action when view a task/bug.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function readTest($objectType, $objectID)
|
||||
{
|
||||
$this->objectModel->read($objectType, $objectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_ACTION)->where('objectID')->eq($objectID)->andWhere('objectType')->eq($objectType)->fetchAll();
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unread actions.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getUnreadActionsTest($actionID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getUnreadActions($actionID);
|
||||
$objects = json_decode($objects);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get product, project, execution of the object.
|
||||
*
|
||||
* @param String $objectType
|
||||
* @param Int $objectID
|
||||
* @param String $actionType
|
||||
* @param String $extra
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getRelatedFieldsTest($objectType, $objectID, $actionType = '', $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->getRelatedFields($objectType, $objectID, $actionType = '', $extra = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get actions of an object.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getListTest($objectType, $objectID)
|
||||
{
|
||||
$objects = $this->objectModel->getList($objectType, $objectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$dirname = dirname(__DIR__) . DS;
|
||||
|
||||
$objects[$objectID]->extra = str_replace($dirname, '', $objects[$objectID]->extra);
|
||||
$objects[$objectID]->extra = trim($objects[$objectID]->extra, "\n");
|
||||
if(strpos($objects[$objectID]->extra, 'href') !== false) $objects[$objectID]->extra = 'a';
|
||||
|
||||
return $objects[$objectID];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test process Project Actions change actionStype.
|
||||
*
|
||||
* @param array $actions
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function processProjectActionsTest($actions)
|
||||
{
|
||||
global $tester;
|
||||
$actions = $tester->dao->select('*')->from(TABLE_ACTION)->where('id')->in($actions)->fetchAll('id');
|
||||
|
||||
$objects = $this->objectModel->processProjectActions($actions);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$IDs = array_keys($objects);
|
||||
return implode(',', $IDs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get action by id.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIdTest($actionID)
|
||||
{
|
||||
$object = $this->objectModel->getById($actionID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTrashesBySearchTest
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param string $type all|hidden
|
||||
* @param int $queryID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTrashesBySearchTest($objectType, $type, $queryID, $orderBy, $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getTrashesBySearch($objectType, $type, $queryID, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get deleted objects.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTrashesTest($objectType, $type, $orderBy, $pager)
|
||||
{
|
||||
$objects = $this->objectModel->getTrashes($objectType, $type, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get object type list of trashes.
|
||||
*
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTrashObjectTypesTest($type)
|
||||
{
|
||||
$objects = $this->objectModel->getTrashObjectTypes($type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get histories of an action.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getHistoryTest($actionID)
|
||||
{
|
||||
$objects = $this->objectModel->getHistory($actionID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects[$actionID];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test log histories for an action.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @param array $changes
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function logHistoryTest($actionID, $changes)
|
||||
{
|
||||
$this->objectModel->logHistory($actionID, $changes);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_HISTORY)->where('action')->eq($actionID)->fetchAll();
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dynamic show action.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getActionConditionTest()
|
||||
{
|
||||
$objects = $this->objectModel->getActionCondition();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dynamic by search.
|
||||
*
|
||||
* @param array $products
|
||||
* @param array $projects
|
||||
* @param array $executions
|
||||
* @param int $queryID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param string $date
|
||||
* @param string $direction
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDynamicBySearchTest($products, $projects, $executions, $queryID, $orderBy = 'date_desc', $pager = null, $date = '', $direction = 'next')
|
||||
{
|
||||
$objects = $this->objectModel->getDynamicBySearch($products, $projects, $executions, $queryID, $orderBy, $pager, $date, $direction);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get actions as dynamic.
|
||||
*
|
||||
* @param string $account
|
||||
* @param string $period
|
||||
* @param string $productID
|
||||
* @param string $projectID
|
||||
* @param string $executionID
|
||||
* @param string $date
|
||||
* @param string $direction
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getDynamicTest($account = 'all', $period = 'all', $productID = 'all', $projectID = 'all', $executionID = 'all', $date = '', $direction = 'next')
|
||||
{
|
||||
$date = $date == 'today' ? date('Y-m-d', time()) : $date;
|
||||
$objects = $this->objectModel->getDynamic($account, $period, 'date_desc', null, $productID, $projectID, $executionID, $date, $direction);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get actions by SQL.
|
||||
*
|
||||
* @param string $sql
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getBySQLTest($sql, $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getBySQL($sql, $orderBy, $pager = null);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test transform the actions for display.
|
||||
*
|
||||
* @param array $actions
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function transformActionsTest($actions)
|
||||
{
|
||||
global $tester;
|
||||
$actions = $tester->dao->select('*')->from(TABLE_ACTION)->where('id')->in($actions)->fetchAll('id');
|
||||
|
||||
$objects = $this->objectModel->transformActions($actions);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get related data by actions.
|
||||
*
|
||||
* @param array $actions
|
||||
* @param string $field
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getRelatedDataByActionsTest($actions, $field)
|
||||
{
|
||||
global $tester;
|
||||
$actions = $tester->dao->select('*')->from(TABLE_ACTION)->where('id')->in($actions)->fetchAll('id');
|
||||
|
||||
$objects = $this->objectModel->getRelatedDataByActions($actions);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects[$field];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get object label.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param string $actionType
|
||||
* @param array $requirements
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getObjectLabelTest($objectType, $objectID, $actionType, $requirements)
|
||||
{
|
||||
$object = $this->objectModel->getObjectLabel($objectType, $objectID, $actionType, $requirements);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test compute the begin date and end date of a period.
|
||||
*
|
||||
* @param string $period
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function computeBeginAndEndTest($period)
|
||||
{
|
||||
$date = $this->objectModel->computeBeginAndEnd($period);
|
||||
|
||||
$today = date('Y-m-d');
|
||||
$tomorrow = date::tomorrow();
|
||||
$yesterday = date::yesterday();
|
||||
$twoDaysAgo = date::twoDaysAgo();
|
||||
|
||||
if($period == 'all') return $date['begin'] == '1970-1-1' and $date['end'] == '2109-1-1';
|
||||
if($period == 'today') return $date['begin'] == $today and $date['end'] == $tomorrow;
|
||||
if($period == 'yesterday') return $date['begin'] == $yesterday and $date['end'] == $today;
|
||||
if($period == 'twodaysago') return $date['begin'] == $twoDaysAgo and $date['end'] == $yesterday;
|
||||
if($period == 'latest3days') return $date['begin'] == $twoDaysAgo and $date['end'] == $tomorrow;
|
||||
if($period == 'thismonth') return $date == date::getThisMonth();
|
||||
if($period == 'lastmonth') return $date == date::getLastMonth();
|
||||
$func = "get$period";
|
||||
extract(date::$func());
|
||||
if($period == 'thisweek') return $date['begin'] == $begin and $date['end'] == $end . ' 23:59:59';
|
||||
if($period == 'lastweek') return $date['begin'] == $begin and $date['end'] == $end . ' 23:59:59';
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete action by objectType.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteByTypeTest($objectType)
|
||||
{
|
||||
$this->objectModel->deleteByType($objectType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_ACTION)->where('objectType')->eq($objectType)->fetchAll();
|
||||
|
||||
return empty($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test undelete a record.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function undeleteTest($actionID)
|
||||
{
|
||||
$this->objectModel->undelete($actionID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByID($actionID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test hide an object.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function hideOneTest($actionID)
|
||||
{
|
||||
$this->objectModel->hideOne($actionID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByID($actionID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test hide all deleted objects.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function hideAllTest()
|
||||
{
|
||||
$this->objectModel->hideAll();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_ACTION)->where('action')->eq('deleted')->fetchAll();
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update comment of a action.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @param string $comment
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function updateCommentTest($actionID, $comment)
|
||||
{
|
||||
$_POST['lastComment'] = $comment;
|
||||
|
||||
$this->objectModel->updateComment($actionID);
|
||||
|
||||
unset($_POST);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByID($actionID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Has pre or next.
|
||||
*
|
||||
* @param string $date
|
||||
* @param string $direction
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPreOrNextTest($date, $direction = 'next')
|
||||
{
|
||||
global $tester;
|
||||
$tester->session->set('actionQueryCondition', '1=1');
|
||||
$result = $this->objectModel->hasPreOrNext($date, $direction);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save global search object index information.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param string $actionType
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function saveIndexTest($objectType, $objectID, $actionType)
|
||||
{
|
||||
$result = $this->objectModel->saveIndex($objectType, $objectID, $actionType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process dynamic for API.
|
||||
*
|
||||
* @param array $dynamics
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function processDynamicForAPITest($dynamics)
|
||||
{
|
||||
$objects = $this->objectModel->processDynamicForAPI($dynamics);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return empty($objects) ? $objects : $objects[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test build date group by actions.
|
||||
*
|
||||
* @param string $direction
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function buildDateGroupTest($direction = 'next', $type = 'today', $orderBy = 'date_desc')
|
||||
{
|
||||
$actions = $this->objectModel->getDynamic('all', $type);
|
||||
$objects = $this->objectModel->buildDateGroup($actions, $direction, $type, $orderBy);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$count = 0;
|
||||
foreach($objects as $object) $count += count($object);
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test restore stages.
|
||||
*
|
||||
* @param array $stageList
|
||||
* @param array $actionIdList
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function restoreStagesTest($stageList, $actionIdList)
|
||||
{
|
||||
$this->objectModel->restoreStages($stageList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$actionList = array();
|
||||
foreach($actionIdList as $actionID) $actionList[$actionID] = $this->objectModel->getByID($actionID);
|
||||
|
||||
return $actionList;
|
||||
}
|
||||
}
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->buildDateGroup();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试创建下一个动作日期组 今天 >> 3
|
||||
测试创建下一个动作日期组 昨天 >> 3
|
||||
测试创建下一个动作日期组 上周 >> 21
|
||||
测试创建下一个动作日期组 今天 >> 3
|
||||
测试创建下一个动作日期组 昨天 >> 3
|
||||
测试创建下一个动作日期组 上周 >> 21
|
||||
测试创建下一个动作日期组 今天 >> 3
|
||||
测试创建下一个动作日期组 昨天 >> 3
|
||||
测试创建下一个动作日期组 上周 >> 21
|
||||
|
||||
*/
|
||||
|
||||
$directionList = array('next', 'pre');
|
||||
$typeList = array('today', 'yesterday', 'lastweek');
|
||||
$orderBy = 'date_asc';
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0])) && p() && e('3'); // 测试创建下一个动作日期组 今天
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[1])) && p() && e('3'); // 测试创建下一个动作日期组 昨天
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[2])) && p() && e('21'); // 测试创建下一个动作日期组 上周
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[0], $orderBy)) && p() && e('3'); // 测试创建下一个动作日期组 今天
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[1], $orderBy)) && p() && e('3'); // 测试创建下一个动作日期组 昨天
|
||||
r($action->buildDateGroupTest($directionList[0], $typeList[2], $orderBy)) && p() && e('21'); // 测试创建下一个动作日期组 上周
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[0])) && p() && e('3'); // 测试创建下一个动作日期组 今天
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[1])) && p() && e('3'); // 测试创建下一个动作日期组 昨天
|
||||
r($action->buildDateGroupTest($directionList[1], $typeList[2])) && p() && e('21'); // 测试创建下一个动作日期组 上周
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->computeBeginAndEnd();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试计算all的日期 >> 1
|
||||
测试计算today的日期 >> 1
|
||||
测试计算yesterday的日期 >> 1
|
||||
测试计算twodaysago的日期 >> 1
|
||||
测试计算latest3days的日期 >> 1
|
||||
测试计算thisweek的日期 >> 1
|
||||
测试计算lastweek的日期 >> 1
|
||||
测试计算thismonth的日期 >> 1
|
||||
测试计算lastmonth的日期 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$typeList = array('all', 'today', 'yesterday', 'twodaysago', 'latest3days', 'thisweek', 'lastweek', 'thismonth', 'lastmonth');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->computeBeginAndEndTest($typeList[0])) && p() && e('1'); // 测试计算all的日期
|
||||
r($action->computeBeginAndEndTest($typeList[1])) && p() && e('1'); // 测试计算today的日期
|
||||
r($action->computeBeginAndEndTest($typeList[2])) && p() && e('1'); // 测试计算yesterday的日期
|
||||
r($action->computeBeginAndEndTest($typeList[3])) && p() && e('1'); // 测试计算twodaysago的日期
|
||||
r($action->computeBeginAndEndTest($typeList[4])) && p() && e('1'); // 测试计算latest3days的日期
|
||||
r($action->computeBeginAndEndTest($typeList[5])) && p() && e('1'); // 测试计算thisweek的日期
|
||||
r($action->computeBeginAndEndTest($typeList[6])) && p() && e('1'); // 测试计算lastweek的日期
|
||||
r($action->computeBeginAndEndTest($typeList[7])) && p() && e('1'); // 测试计算thismonth的日期
|
||||
r($action->computeBeginAndEndTest($typeList[8])) && p() && e('1'); // 测试计算lastmonth的日期
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->create();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试创建task 1 edited动态 >> task,,edited,
|
||||
测试创建project 11 editestimate动态 >> project,,editestimate,
|
||||
测试创建user 1 login动态 >> user,,login,
|
||||
测试创建bug 1 closed动态 >> bug,,closed,
|
||||
测试创建story 1 comment动态 >> story,,comments,测试备注
|
||||
测试创建游客 logout动态 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$objectTypeList = array('task', 'project', 'user', 'bug', 'story');
|
||||
$objectIDList = array('1', '11');
|
||||
$actionTypeList = array('edited', 'editestimate', 'login', 'closed', 'comments', 'logout');
|
||||
$actor = 'guest';
|
||||
$comment = '测试备注';
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->createTest($objectTypeList[0], $objectIDList[0], $actionTypeList[0])) && p('objectType,objectId,action,comment') && e('task,,edited,'); // 测试创建task 1 edited动态
|
||||
r($action->createTest($objectTypeList[1], $objectIDList[1], $actionTypeList[1])) && p('objectType,objectId,action,comment') && e('project,,editestimate,'); // 测试创建project 11 editestimate动态
|
||||
r($action->createTest($objectTypeList[2], $objectIDList[0], $actionTypeList[2])) && p('objectType,objectId,action,comment') && e('user,,login,'); // 测试创建user 1 login动态
|
||||
r($action->createTest($objectTypeList[3], $objectIDList[0], $actionTypeList[3])) && p('objectType,objectId,action,comment') && e('bug,,closed,'); // 测试创建bug 1 closed动态
|
||||
r($action->createTest($objectTypeList[4], $objectIDList[0], $actionTypeList[4], $comment)) && p('objectType,objectId,action,comment') && e('story,,comments,测试备注'); // 测试创建story 1 comment动态
|
||||
r($action->createTest($objectTypeList[2], $objectIDList[0], $actionTypeList[5], '', '', $actor)) && p() && e('0'); // 测试创建游客 logout动态
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: zt_action
|
||||
author: auto_getbyid
|
||||
version: "1.0"
|
||||
fields:
|
||||
- field: id
|
||||
range: 101-105
|
||||
- field: objectType
|
||||
range: product,story,productplan,release,project
|
||||
- field: action
|
||||
range: common,extra,opened,created,changed
|
||||
- field: comment
|
||||
range: 1-5
|
||||
prefix: 这是一个系统日志测试备注
|
||||
...
|
||||
@@ -0,0 +1,68 @@
|
||||
-- MySQL dump 10.19 Distrib 10.3.34-MariaDB, for debian-linux-gnu (x86_64)
|
||||
--
|
||||
-- Host: 127.0.0.1 Database: zentao1243
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.7.36
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `zt_action`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `zt_action`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `zt_action` (
|
||||
`id` int(9) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`objectType` varchar(30) NOT NULL DEFAULT '',
|
||||
`objectID` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`product` text NOT NULL,
|
||||
`project` mediumint(8) unsigned NOT NULL,
|
||||
`execution` mediumint(8) unsigned NOT NULL,
|
||||
`actor` varchar(100) NOT NULL DEFAULT '',
|
||||
`action` varchar(80) NOT NULL DEFAULT '',
|
||||
`date` datetime NOT NULL,
|
||||
`comment` text NOT NULL,
|
||||
`extra` text,
|
||||
`read` enum('0','1') NOT NULL DEFAULT '0',
|
||||
`vision` varchar(10) NOT NULL DEFAULT 'rnd',
|
||||
`efforted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `date` (`date`),
|
||||
KEY `actor` (`actor`),
|
||||
KEY `project` (`execution`),
|
||||
KEY `objectID` (`objectID`),
|
||||
KEY `action` (`action`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=420 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `zt_action`
|
||||
--
|
||||
|
||||
LOCK TABLES `zt_action` WRITE;
|
||||
/*!40000 ALTER TABLE `zt_action` DISABLE KEYS */;
|
||||
INSERT INTO `zt_action` VALUES (101,'product',0,'',0,0,'','common','0000-00-00 00:00:00','这是一个系统日志测试备注1',NULL,'0','rnd',0),(102,'story',0,'',0,0,'','extra','0000-00-00 00:00:00','这是一个系统日志测试备注2',NULL,'0','rnd',0),(103,'productplan',0,'',0,0,'','opened','0000-00-00 00:00:00','这是一个系统日志测试备注3',NULL,'0','rnd',0),(104,'release',0,'',0,0,'','created','0000-00-00 00:00:00','这是一个系统日志测试备注4',NULL,'0','rnd',0),(105,'project',0,'',0,0,'','changed','0000-00-00 00:00:00','这是一个系统日志测试备注5',NULL,'0','rnd',0);
|
||||
/*!40000 ALTER TABLE `zt_action` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2022-11-17 8:52:10
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->deleteByType();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试删除object为空动态 >> 1
|
||||
测试删除objectType为story的动态 >> 1
|
||||
测试删除objectType为不存在的test的动态 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->deleteByTypeTest('')) && p() && e('1'); // 测试删除object为空动态
|
||||
r($action->deleteByTypeTest('story')) && p() && e('1'); // 测试删除objectType为story的动态
|
||||
r($action->deleteByTypeTest('test')) && p() && e('1'); // 测试删除objectType为不存在的test的动态
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getActionCondition();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取用户可以看到的动态的条件 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getActionConditionTest()) && p() && e('0'); // 获取用户可以看到的动态的条件
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
$action = zdTable('action');
|
||||
$action->id->range('101-105');
|
||||
$action->objectType->range("product,story,productplan,release,project");
|
||||
$action->action->range("common,extra,opened,created,changed");
|
||||
$action->comment->range("1-5")->prefix("这是一个系统日志测试备注");
|
||||
$action->gen(5);
|
||||
|
||||
//zdTable('action')->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getById();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取动态1的信息 >> product,,common,这是一个系统日志测试备注1
|
||||
测试获取动态2的信息 >> story,,extra,这是一个系统日志测试备注2
|
||||
测试获取动态3的信息 >> productplan,,opened,这是一个系统日志测试备注3
|
||||
测试获取动态4的信息 >> release,,created,这是一个系统日志测试备注4
|
||||
测试获取动态5的信息 >> project,,changed,这是一个系统日志测试备注5
|
||||
|
||||
*/
|
||||
|
||||
$actionIDList = array('101', '102', '103', '104', '105');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getByIdTest($actionIDList[0])) && p('objectType,objectId,action,comment') && e('product,,common,这是一个系统日志测试备注1'); // 测试获取动态1的信息
|
||||
r($action->getByIdTest($actionIDList[1])) && p('objectType,objectId,action,comment') && e('story,,extra,这是一个系统日志测试备注2'); // 测试获取动态2的信息
|
||||
r($action->getByIdTest($actionIDList[2])) && p('objectType,objectId,action,comment') && e('productplan,,opened,这是一个系统日志测试备注3'); // 测试获取动态3的信息
|
||||
r($action->getByIdTest($actionIDList[3])) && p('objectType,objectId,action,comment') && e('release,,created,这是一个系统日志测试备注4'); // 测试获取动态4的信息
|
||||
r($action->getByIdTest($actionIDList[4])) && p('objectType,objectId,action,comment') && e('project,,changed,这是一个系统日志测试备注5'); // 测试获取动态5的信息
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getBySQL();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
查询id like %1的动作个数 >> 12
|
||||
查询objectType = product的动作个数 >> 5
|
||||
查询objectID < 10的动作个数 >> 9
|
||||
查询action = opend的动作个数 >> 3
|
||||
查询read = 0的动作个数 >> 50
|
||||
|
||||
*/
|
||||
|
||||
$sql1 = "id like '1%'";
|
||||
$sql2 = "objectType = 'product'";
|
||||
$sql3 = "objectID < 10";
|
||||
$sql4 = "action = 'opened'";
|
||||
$sql5 = "`read` = '0'";
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getBySQLTest($sql1)) && p() && e('12'); // 查询id like %1的动作个数
|
||||
r($action->getBySQLTest($sql2)) && p() && e('5'); // 查询objectType = product的动作个数
|
||||
r($action->getBySQLTest($sql3)) && p() && e('9'); // 查询objectID < 10的动作个数
|
||||
r($action->getBySQLTest($sql4)) && p() && e('3'); // 查询action = opend的动作个数
|
||||
r($action->getBySQLTest($sql5)) && p() && e('50'); // 查询read = 0的动作个数
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getDynamic();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
查找全部动态 >> 90
|
||||
查找用户admin动态 >> 30
|
||||
查找用户dev17动态 >> 30
|
||||
查找用户test18动态 >> 30
|
||||
查找今天的动态 >> 3
|
||||
查找昨天的动态 >> 3
|
||||
查找上周的动态 >> 21
|
||||
查找产品1的动态 >> 0
|
||||
查找产品2的动态 >> 0
|
||||
查找产品3的动态 >> 0
|
||||
查找项目1的动态 >> 0
|
||||
查找项目2的动态 >> 0
|
||||
查找项目3的动态 >> 0
|
||||
查找执行1的动态 >> 0
|
||||
查找执行2的动态 >> 0
|
||||
查找执行3的动态 >> 0
|
||||
查找今天的动态 >> 87
|
||||
|
||||
*/
|
||||
|
||||
$accountList = array('all', 'admin', 'dev17', 'test18');
|
||||
$typeList = array('all', 'today', 'yesterday', 'lastweek');
|
||||
$productIDList = array('all', 1, 2, 3);
|
||||
$projectIDList = array('all', 1, 2, 3);
|
||||
$executionIDList = array('all', 1, 2, 3);
|
||||
$dateList = array('', 'today');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getDynamicTest()) && p() && e('90'); // 查找全部动态
|
||||
r($action->getDynamicTest($accountList[1])) && p() && e('30'); // 查找用户admin动态
|
||||
r($action->getDynamicTest($accountList[2])) && p() && e('30'); // 查找用户dev17动态
|
||||
r($action->getDynamicTest($accountList[3])) && p() && e('30'); // 查找用户test18动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[1])) && p() && e('3'); // 查找今天的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[2])) && p() && e('3'); // 查找昨天的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[3])) && p() && e('21'); // 查找上周的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[1])) && p() && e('0'); // 查找产品1的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[2])) && p() && e('0'); // 查找产品2的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[3])) && p() && e('0'); // 查找产品3的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[1])) && p() && e('0'); // 查找项目1的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[2])) && p() && e('0'); // 查找项目2的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[3])) && p() && e('0'); // 查找项目3的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[0], $executionIDList[1])) && p() && e('0'); // 查找执行1的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[0], $executionIDList[2])) && p() && e('0'); // 查找执行2的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[0], $executionIDList[3])) && p() && e('0'); // 查找执行3的动态
|
||||
r($action->getDynamicTest($accountList[0], $typeList[0], $productIDList[0], $projectIDList[0], $executionIDList[0], $dateList[1])) && p() && e('87'); // 查找今天的动态
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getDynamicBySearch();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取product all, project all, execution all排序为date倒序的所有动态 >> 64,testsuite
|
||||
获取product all, project all, execution all排序为date正序的所有动态 >> 33,case
|
||||
获取product 1, project all, execution all排序为date倒序的所有动态 >> 64,testsuite
|
||||
获取product 1, project all, execution all排序为date正序的所有动态 >> 33,case
|
||||
获取product all, project 1, execution all排序为date倒序的所有动态 >> 64,testsuite
|
||||
获取product all, project 1, execution all排序为date正序的所有动态 >> 33,case
|
||||
获取product all, project all, execution 1排序为date倒序的所有动态 >> 64,testsuite
|
||||
获取product all, project all, execution 1排序为date正序的所有动态 >> 33,case
|
||||
获取product all, project all, execution all排序为date倒序的今天之前的动态 >> 33,case
|
||||
获取product all, project all, execution all排序为date倒序的今天之后的动态 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$products = array('all', 1, 2, 3);
|
||||
$projects = array('all', 1, 2, 3);
|
||||
$executions = array('all', 1, 2, 3);
|
||||
$queryID = 0;
|
||||
$orderByList = array('date_desc', 'date_asc');
|
||||
$pager = null;
|
||||
$dateList = array('', 'today');
|
||||
$directionList = array('next', 'pre');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getDynamicBySearchTest($products[0], $projects[0], $executions[0], $queryID, $orderByList[0], $pager, $dateList[0], $directionList[0])) && p('1:id,objectType') && e('64,testsuite'); // 获取product all, project all, execution all排序为date倒序的所有动态
|
||||
r($action->getDynamicBySearchTest($products[0], $projects[0], $executions[0], $queryID, $orderByList[1], $pager, $dateList[0], $directionList[0])) && p('1:id,objectType') && e('33,case'); // 获取product all, project all, execution all排序为date正序的所有动态
|
||||
r($action->getDynamicBySearchTest($products[1], $projects[0], $executions[0], $queryID, $orderByList[0], $pager, $dateList[0], $directionList[0])) && p('1:id,objectType') && e('64,testsuite'); // 获取product 1, project all, execution all排序为date倒序的所有动态
|
||||
r($action->getDynamicBySearchTest($products[1], $projects[0], $executions[0], $queryID, $orderByList[1], $pager, $dateList[0], $directionList[0])) && p('1:id,objectType') && e('33,case'); // 获取product 1, project all, execution all排序为date正序的所有动态
|
||||
r($action->getDynamicBySearchTest($products[0], $projects[1], $executions[0], $queryID, $orderByList[0], $pager, $dateList[0], $directionList[0])) && p('1:id,objectType') && e('64,testsuite'); // 获取product all, project 1, execution all排序为date倒序的所有动态
|
||||
r($action->getDynamicBySearchTest($products[0], $projects[1], $executions[0], $queryID, $orderByList[1], $pager, $dateList[0], $directionList[0])) && p('1:id,objectType') && e('33,case'); // 获取product all, project 1, execution all排序为date正序的所有动态
|
||||
r($action->getDynamicBySearchTest($products[0], $projects[0], $executions[1], $queryID, $orderByList[0], $pager, $dateList[0], $directionList[0])) && p('1:id,objectType') && e('64,testsuite'); // 获取product all, project all, execution 1排序为date倒序的所有动态
|
||||
r($action->getDynamicBySearchTest($products[0], $projects[0], $executions[1], $queryID, $orderByList[1], $pager, $dateList[0], $directionList[0])) && p('1:id,objectType') && e('33,case'); // 获取product all, project all, execution 1排序为date正序的所有动态
|
||||
r($action->getDynamicBySearchTest($products[0], $projects[0], $executions[0], $queryID, $orderByList[1], $pager, $dateList[1], $directionList[0])) && p('1:id,objectType') && e('33,case'); // 获取product all, project all, execution all排序为date倒序的今天之前的动态
|
||||
r($action->getDynamicBySearchTest($products[0], $projects[0], $executions[0], $queryID, $orderByList[1], $pager, $dateList[1], $directionList[1])) && p() && e('0'); // 获取product all, project all, execution all排序为date倒序的今天之后的动态
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getHistory();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
查找actionID为1的历史记录 >> resolution,1,2
|
||||
查找actionID为2的历史记录 >> resolvedBuild,2,3
|
||||
查找actionID为3的历史记录 >> resolvedDate,2020-01-01,2020-01-17
|
||||
查找actionID为4的历史记录 >> status,doing,done
|
||||
查找actionID为5的历史记录 >> resolution,1,2
|
||||
|
||||
*/
|
||||
$actionIDList = array('1', '2', '3', '4', '5');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getHistoryTest($actionIDList[0])) && p("0:field,old,new") && e('resolution,1,2'); // 查找actionID为1的历史记录
|
||||
r($action->getHistoryTest($actionIDList[1])) && p("0:field,old,new") && e('resolvedBuild,2,3'); // 查找actionID为2的历史记录
|
||||
r($action->getHistoryTest($actionIDList[2])) && p("0:field,old,new") && e('resolvedDate,2020-01-01,2020-01-17'); // 查找actionID为3的历史记录
|
||||
r($action->getHistoryTest($actionIDList[3])) && p("0:field,old,new") && e('status,doing,done'); // 查找actionID为4的历史记录
|
||||
r($action->getHistoryTest($actionIDList[4])) && p("0:field,old,new") && e('resolution,1,2'); // 查找actionID为5的历史记录
|
||||
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getList();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取objectType product objectId 1的动态信息 >> 1,admin,1
|
||||
测试获取objectType story objectId 2的动态信息 >> 2,dev17,1
|
||||
测试获取objectType productplan objectId 3的动态信息 >> 3,test18,1
|
||||
测试获取objectType release objectId 4的动态信息 >> 4,admin,1
|
||||
测试获取objectType project objectId 5的动态信息 >> 5,dev17,11
|
||||
测试获取objectType task objectId 6的动态信息 >> 6,test18,1
|
||||
测试获取objectType build objectId 7的动态信息 >> 7,admin,1
|
||||
测试获取objectType bug objectId 8的动态信息 >> 8,dev17,1
|
||||
测试获取objectType testcase objectId 9的动态信息 >> 9,test18,2
|
||||
测试获取objectType case objectId 10的动态信息 >> 10,admin,1
|
||||
测试获取objectType testtask objectId 11的动态信息 >> 11,dev17,1
|
||||
测试获取objectType user objectId 12的动态信息 >> 12,test18,1
|
||||
测试获取objectType doc objectId 13的动态信息 >> 13,admin,1
|
||||
测试获取objectType doclib objectId 14的动态信息 >> 14,dev17,1
|
||||
测试获取objectType todo objectId 15的动态信息 >> 15,test18,1
|
||||
测试获取objectType branch objectId 16的动态信息 >> 16,admin,1
|
||||
测试获取objectType module objectId 17的动态信息 >> 17,dev17,1
|
||||
测试获取objectType testsuite objectId 18的动态信息 >> 18,test18,a
|
||||
测试获取objectType caselib objectId 19的动态信息 >> 19,admin,1
|
||||
测试获取objectType testreport objectId 20的动态信息 >> 20,dev17,1
|
||||
测试获取objectType entry objectId 21的动态信息 >> 21,test18,1
|
||||
测试获取objectType webhook objectId 22的动态信息 >> 22,admin,a
|
||||
测试获取objectType review objectId 23的动态信息 >> 23,dev17,1
|
||||
测试获取objectType product objectId 24的动态信息 >> 24,test18,1
|
||||
测试获取objectType story objectId 25的动态信息 >> 25,admin,1
|
||||
测试获取objectType productplan objectId 26的动态信息 >> 26,dev17,1
|
||||
测试获取objectType release objectId 27的动态信息 >> 27,test18,1
|
||||
测试获取objectType project objectId 28的动态信息 >> 28,admin,33
|
||||
测试获取objectType task objectId 29的动态信息 >> 29,dev17,1
|
||||
测试获取objectType build objectId 30的动态信息 >> 30,test18,1
|
||||
测试获取objectType bug objectId 31的动态信息 >> 31,admin,1
|
||||
测试获取objectType testcase objectId 32的动态信息 >> 32,项目经理17,1
|
||||
测试获取objectType case objectId 33的动态信息 >> 33,test18,1
|
||||
测试获取objectType testtask objectId 34的动态信息 >> 34,admin,1
|
||||
测试获取objectType user objectId 35的动态信息 >> 35,dev17,1
|
||||
测试获取objectType doc objectId 36的动态信息 >> 36,test18,1
|
||||
测试获取objectType doclib objectId 37的动态信息 >> 37,admin,1
|
||||
测试获取objectType todo objectId 38的动态信息 >> 38,dev17,1
|
||||
测试获取objectType branch objectId 39的动态信息 >> 39,test18,a
|
||||
|
||||
*/
|
||||
|
||||
$objectType = array('product', 'story', 'productplan', 'release', 'project', 'task', 'build', 'bug', 'testcase', 'case', 'testtask', 'user', 'doc', 'doclib', 'todo', 'branch', 'module', 'testsuite', 'caselib', 'testreport', 'entry', 'webhook', 'review');
|
||||
$objectId = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39);
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getListTest($objectType[0], $objectId[0])) && p('id,actor,extra') && e("1,admin,1"); // 测试获取objectType product objectId 1的动态信息
|
||||
r($action->getListTest($objectType[1], $objectId[1])) && p('id,actor,extra') && e("2,dev17,1"); // 测试获取objectType story objectId 2的动态信息
|
||||
r($action->getListTest($objectType[2], $objectId[2])) && p('id,actor,extra') && e("3,test18,1"); // 测试获取objectType productplan objectId 3的动态信息
|
||||
r($action->getListTest($objectType[3], $objectId[3])) && p('id,actor,extra') && e("4,admin,1"); // 测试获取objectType release objectId 4的动态信息
|
||||
r($action->getListTest($objectType[4], $objectId[4])) && p('id,actor,extra') && e("5,dev17,11"); // 测试获取objectType project objectId 5的动态信息
|
||||
r($action->getListTest($objectType[5], $objectId[5])) && p('id,actor,extra') && e("6,test18,1"); // 测试获取objectType task objectId 6的动态信息
|
||||
r($action->getListTest($objectType[6], $objectId[6])) && p('id,actor,extra') && e("7,admin,1"); // 测试获取objectType build objectId 7的动态信息
|
||||
r($action->getListTest($objectType[7], $objectId[7])) && p('id,actor,extra') && e("8,dev17,1"); // 测试获取objectType bug objectId 8的动态信息
|
||||
r($action->getListTest($objectType[8], $objectId[8])) && p('id,actor,extra') && e("9,test18,2"); // 测试获取objectType testcase objectId 9的动态信息
|
||||
r($action->getListTest($objectType[9], $objectId[9])) && p('id,actor,extra') && e("10,admin,1"); // 测试获取objectType case objectId 10的动态信息
|
||||
r($action->getListTest($objectType[10], $objectId[10])) && p('id,actor,extra') && e("11,dev17,1"); // 测试获取objectType testtask objectId 11的动态信息
|
||||
r($action->getListTest($objectType[11], $objectId[11])) && p('id,actor,extra') && e("12,test18,1"); // 测试获取objectType user objectId 12的动态信息
|
||||
r($action->getListTest($objectType[12], $objectId[12])) && p('id,actor,extra') && e("13,admin,1"); // 测试获取objectType doc objectId 13的动态信息
|
||||
r($action->getListTest($objectType[13], $objectId[13])) && p('id,actor,extra') && e("14,dev17,1"); // 测试获取objectType doclib objectId 14的动态信息
|
||||
r($action->getListTest($objectType[14], $objectId[14])) && p('id,actor,extra') && e("15,test18,1"); // 测试获取objectType todo objectId 15的动态信息
|
||||
r($action->getListTest($objectType[15], $objectId[15])) && p('id,actor,extra') && e("16,admin,1"); // 测试获取objectType branch objectId 16的动态信息
|
||||
r($action->getListTest($objectType[16], $objectId[16])) && p('id,actor,extra') && e("17,dev17,1"); // 测试获取objectType module objectId 17的动态信息
|
||||
r($action->getListTest($objectType[17], $objectId[17])) && p('id,actor,extra') && e("18,test18,a"); // 测试获取objectType testsuite objectId 18的动态信息
|
||||
r($action->getListTest($objectType[18], $objectId[18])) && p('id,actor,extra') && e("19,admin,1"); // 测试获取objectType caselib objectId 19的动态信息
|
||||
r($action->getListTest($objectType[19], $objectId[19])) && p('id,actor,extra') && e("20,dev17,1"); // 测试获取objectType testreport objectId 20的动态信息
|
||||
r($action->getListTest($objectType[20], $objectId[20])) && p('id,actor,extra') && e("21,test18,1"); // 测试获取objectType entry objectId 21的动态信息
|
||||
r($action->getListTest($objectType[21], $objectId[21])) && p('id,actor,extra') && e("22,admin,a"); // 测试获取objectType webhook objectId 22的动态信息
|
||||
r($action->getListTest($objectType[22], $objectId[22])) && p('id,actor,extra') && e("23,dev17,1"); // 测试获取objectType review objectId 23的动态信息
|
||||
r($action->getListTest($objectType[0], $objectId[23])) && p('id,actor,extra') && e("24,test18,1"); // 测试获取objectType product objectId 24的动态信息
|
||||
r($action->getListTest($objectType[1], $objectId[24])) && p('id,actor,extra') && e("25,admin,1"); // 测试获取objectType story objectId 25的动态信息
|
||||
r($action->getListTest($objectType[2], $objectId[25])) && p('id,actor,extra') && e("26,dev17,1"); // 测试获取objectType productplan objectId 26的动态信息
|
||||
r($action->getListTest($objectType[3], $objectId[26])) && p('id,actor,extra') && e("27,test18,1"); // 测试获取objectType release objectId 27的动态信息
|
||||
r($action->getListTest($objectType[4], $objectId[27])) && p('id,actor,extra') && e("28,admin,33"); // 测试获取objectType project objectId 28的动态信息
|
||||
r($action->getListTest($objectType[5], $objectId[28])) && p('id,actor,extra') && e("29,dev17,1"); // 测试获取objectType task objectId 29的动态信息
|
||||
r($action->getListTest($objectType[6], $objectId[29])) && p('id,actor,extra') && e("30,test18,1"); // 测试获取objectType build objectId 30的动态信息
|
||||
r($action->getListTest($objectType[7], $objectId[30])) && p('id,actor,extra') && e("31,admin,1"); // 测试获取objectType bug objectId 31的动态信息
|
||||
r($action->getListTest($objectType[8], $objectId[31])) && p('id,actor,extra') && e("32,项目经理17,1"); // 测试获取objectType testcase objectId 32的动态信息
|
||||
r($action->getListTest($objectType[9], $objectId[32])) && p('id,actor,extra') && e("33,test18,1"); // 测试获取objectType case objectId 33的动态信息
|
||||
r($action->getListTest($objectType[10], $objectId[33])) && p('id,actor,extra') && e("34,admin,1"); // 测试获取objectType testtask objectId 34的动态信息
|
||||
r($action->getListTest($objectType[11], $objectId[34])) && p('id,actor,extra') && e("35,dev17,1"); // 测试获取objectType user objectId 35的动态信息
|
||||
r($action->getListTest($objectType[12], $objectId[35])) && p('id,actor,extra') && e("36,test18,1"); // 测试获取objectType doc objectId 36的动态信息
|
||||
r($action->getListTest($objectType[13], $objectId[36])) && p('id,actor,extra') && e("37,admin,1"); // 测试获取objectType doclib objectId 37的动态信息
|
||||
r($action->getListTest($objectType[14], $objectId[37])) && p('id,actor,extra') && e("38,dev17,1"); // 测试获取objectType todo objectId 38的动态信息
|
||||
r($action->getListTest($objectType[15], $objectId[38])) && p('id,actor,extra') && e("39,test18,a"); // 测试获取objectType branch objectId 39的动态信息
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getObjectLabel();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取objectType product objectId 1的动态信息 >> 产品|product|view|productID=%s
|
||||
测试获取objectType story objectId 2的动态信息 >> 研发需求|story|view|storyID=%s
|
||||
测试获取objectType productplan objectId 3的动态信息 >> 计划|productplan|view|productID=%s
|
||||
测试获取objectType release objectId 4的动态信息 >> 发布|release|view|productID=%s
|
||||
测试获取objectType project objectId 5的动态信息 >> 项目|project|index|projectID=%s
|
||||
测试获取objectType task objectId 6的动态信息 >> 任务|task|view|taskID=%s
|
||||
测试获取objectType build objectId 7的动态信息 >> 版本|build|view|buildID=%s
|
||||
测试获取objectType bug objectId 8的动态信息 >> Bug|bug|view|bugID=%s
|
||||
测试获取objectType testcase objectId 9的动态信息 >> testcase
|
||||
测试获取objectType case objectId 10的动态信息 >> 用例|testcase|view|caseID=%s
|
||||
测试获取objectType testtask objectId 11的动态信息 >> 测试单|testtask|view|caseID=%s
|
||||
测试获取objectType user objectId 12的动态信息 >> 用户|user|view|account=%s
|
||||
测试获取objectType doclib objectId 14的动态信息 >> 文档库|doc|tablecontents|type=%s&objectID=%s&libID=%s
|
||||
测试获取objectType todo objectId 15的动态信息 >> 待办|todo|view|todoID=%s
|
||||
测试获取objectType branch objectId 16的动态信息 >> branch
|
||||
测试获取objectType module objectId 17的动态信息 >> 模块|tree|browse|productid=%s&type=story¤tModuleID=0&branch=all
|
||||
测试获取objectType testsuite objectId 18的动态信息 >> 测试套件|testsuite|view|suiteID=%s
|
||||
测试获取objectType caselib objectId 19的动态信息 >> 用例库|caselib|view|libID=%s
|
||||
测试获取objectType testreport objectId 20的动态信息 >> 报告|testreport|view|report=%s
|
||||
测试获取objectType entry objectId 21的动态信息 >> 应用|entry|browse|
|
||||
测试获取objectType webhook objectId 22的动态信息 >> Webhook|webhook|browse|
|
||||
测试获取objectType review objectId 23的动态信息 >> review
|
||||
测试获取objectType story objectId 25的动态信息 >> 用户需求|story|view|storyID=%s
|
||||
|
||||
*/
|
||||
|
||||
$objectType = array('product', 'story', 'productplan', 'release', 'project', 'task', 'build', 'bug', 'testcase', 'case', 'testtask', 'user', 'doc', 'doclib', 'todo', 'branch', 'module', 'testsuite', 'caselib', 'testreport', 'entry', 'webhook', 'review');
|
||||
$objectId = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25);
|
||||
$actionType = array('common', 'extra', 'opened', 'created', 'changed', 'edited', 'assigned', 'closed', 'deleted', 'deletedfile', 'editfile', 'erased', 'undeleted', 'hidden', 'commented', 'activated', 'blocked', 'moved', 'confirmed', 'caseconfirmed', 'bugconfirmed', 'frombug', 'started', 'delayed');
|
||||
$requirements = array('25' => '25');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getObjectLabelTest($objectType[0], $objectId[0], $actionType[0], $requirements)) && p() && e('产品|product|view|productID=%s'); // 测试获取objectType product objectId 1的动态信息
|
||||
r($action->getObjectLabelTest($objectType[1], $objectId[1], $actionType[1], $requirements)) && p() && e('研发需求|story|view|storyID=%s'); // 测试获取objectType story objectId 2的动态信息
|
||||
r($action->getObjectLabelTest($objectType[2], $objectId[2], $actionType[2], $requirements)) && p() && e('计划|productplan|view|productID=%s'); // 测试获取objectType productplan objectId 3的动态信息
|
||||
r($action->getObjectLabelTest($objectType[3], $objectId[3], $actionType[3], $requirements)) && p() && e('发布|release|view|productID=%s'); // 测试获取objectType release objectId 4的动态信息
|
||||
r($action->getObjectLabelTest($objectType[4], $objectId[4], $actionType[4], $requirements)) && p() && e('项目|project|index|projectID=%s'); // 测试获取objectType project objectId 5的动态信息
|
||||
r($action->getObjectLabelTest($objectType[5], $objectId[5], $actionType[5], $requirements)) && p() && e('任务|task|view|taskID=%s'); // 测试获取objectType task objectId 6的动态信息
|
||||
r($action->getObjectLabelTest($objectType[6], $objectId[6], $actionType[6], $requirements)) && p() && e('版本|build|view|buildID=%s'); // 测试获取objectType build objectId 7的动态信息
|
||||
r($action->getObjectLabelTest($objectType[7], $objectId[7], $actionType[7], $requirements)) && p() && e('Bug|bug|view|bugID=%s'); // 测试获取objectType bug objectId 8的动态信息
|
||||
r($action->getObjectLabelTest($objectType[8], $objectId[8], $actionType[8], $requirements)) && p() && e('testcase'); // 测试获取objectType testcase objectId 9的动态信息
|
||||
r($action->getObjectLabelTest($objectType[9], $objectId[9], $actionType[9], $requirements)) && p() && e('用例|testcase|view|caseID=%s'); // 测试获取objectType case objectId 10的动态信息
|
||||
r($action->getObjectLabelTest($objectType[10], $objectId[10], $actionType[10], $requirements)) && p() && e('测试单|testtask|view|caseID=%s'); // 测试获取objectType testtask objectId 11的动态信息
|
||||
r($action->getObjectLabelTest($objectType[11], $objectId[11], $actionType[11], $requirements)) && p() && e('用户|user|view|account=%s'); // 测试获取objectType user objectId 12的动态信息
|
||||
r($action->getObjectLabelTest($objectType[13], $objectId[13], $actionType[13], $requirements)) && p() && e('文档库|doc|tablecontents|type=%s&objectID=%s&libID=%s'); // 测试获取objectType doclib objectId 14的动态信息
|
||||
r($action->getObjectLabelTest($objectType[14], $objectId[14], $actionType[14], $requirements)) && p() && e('待办|todo|view|todoID=%s'); // 测试获取objectType todo objectId 15的动态信息
|
||||
r($action->getObjectLabelTest($objectType[15], $objectId[15], $actionType[15], $requirements)) && p() && e('branch'); // 测试获取objectType branch objectId 16的动态信息
|
||||
r($action->getObjectLabelTest($objectType[16], $objectId[16], $actionType[16], $requirements)) && p() && e('模块|tree|browse|productid=%s&type=story¤tModuleID=0&branch=all'); // 测试获取objectType module objectId 17的动态信息
|
||||
r($action->getObjectLabelTest($objectType[17], $objectId[17], $actionType[17], $requirements)) && p() && e('测试套件|testsuite|view|suiteID=%s'); // 测试获取objectType testsuite objectId 18的动态信息
|
||||
r($action->getObjectLabelTest($objectType[18], $objectId[18], $actionType[18], $requirements)) && p() && e('用例库|caselib|view|libID=%s'); // 测试获取objectType caselib objectId 19的动态信息
|
||||
r($action->getObjectLabelTest($objectType[19], $objectId[19], $actionType[19], $requirements)) && p() && e('报告|testreport|view|report=%s'); // 测试获取objectType testreport objectId 20的动态信息
|
||||
r($action->getObjectLabelTest($objectType[20], $objectId[20], $actionType[20], $requirements)) && p() && e('应用|entry|browse|'); // 测试获取objectType entry objectId 21的动态信息
|
||||
r($action->getObjectLabelTest($objectType[21], $objectId[21], $actionType[21], $requirements)) && p() && e('Webhook|webhook|browse|'); // 测试获取objectType webhook objectId 22的动态信息
|
||||
r($action->getObjectLabelTest($objectType[22], $objectId[22], $actionType[22], $requirements)) && p() && e('review'); // 测试获取objectType review objectId 23的动态信息
|
||||
r($action->getObjectLabelTest($objectType[1], $objectId[23], $actionType[23], $requirements)) && p() && e('用户需求|story|view|storyID=%s'); // 测试获取objectType story objectId 25的动态信息
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getRelatedDataByActions();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取动态1 2 3 4 5 objectNames的关联信息 >> 项目集5
|
||||
获取动态1 2 3 4 5 objectNames的关联信息 >> guest
|
||||
获取动态1 2 3 4 5 relatedProjects的关联信息 >> 5
|
||||
获取动态1 2 3 4 5 requirements的关联信息 >> 0
|
||||
获取动态6 7 8 9 10 objectNames的关联信息 >> 这个是测试用例10
|
||||
获取动态6 7 8 9 10 objectNames的关联信息 >> guest
|
||||
获取动态6 7 8 9 10 relatedProjects的关联信息 >> 0
|
||||
获取动态6 7 8 9 10 requirements的关联信息 >> 0
|
||||
获取动态11 12 13 14 15 objectNames的关联信息 >> 测试单15的待办
|
||||
获取动态11 12 13 14 15 objectNames的关联信息 >> guest
|
||||
获取动态11 12 13 14 15 relatedProjects的关联信息 >> 0
|
||||
获取动态11 12 13 14 15 requirements的关联信息 >> 0
|
||||
获取动态16 17 18 19 20 objectNames的关联信息 >> 这是测试套件名称19
|
||||
获取动态16 17 18 19 20 objectNames的关联信息 >> guest
|
||||
获取动态16 17 18 19 20 relatedProjects的关联信息 >> 0
|
||||
获取动态16 17 18 19 20 requirements的关联信息 >> 0
|
||||
获取动态21 22 23 24 25 objectNames的关联信息 >> 用户需求25
|
||||
获取动态21 22 23 24 25 objectNames的关联信息 >> guest
|
||||
获取动态21 22 23 24 25 requirements的关联信息 >> 25
|
||||
|
||||
*/
|
||||
|
||||
$actions = array('1,2,3,4,5', '6,7,8,9,10', '11,12,13,14,15', '16,17,18,19,20', '21,22,23,24,25');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getRelatedDataByActionsTest($actions[0], 'objectNames')) && p('project:5') && e('项目集5'); // 获取动态1 2 3 4 5 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[0], 'objectNames')) && p('user:0') && e('guest'); // 获取动态1 2 3 4 5 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[0], 'relatedProjects')) && p('project:5') && e('5'); // 获取动态1 2 3 4 5 relatedProjects的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[0], 'requirements')) && p() && e('0'); // 获取动态1 2 3 4 5 requirements的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[1], 'objectNames')) && p('case:10') && e('这个是测试用例10'); // 获取动态6 7 8 9 10 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[1], 'objectNames')) && p('user:0') && e('guest'); // 获取动态6 7 8 9 10 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[1], 'relatedProjects')) && p('case:10') && e('0'); // 获取动态6 7 8 9 10 relatedProjects的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[1], 'requirements')) && p() && e('0'); // 获取动态6 7 8 9 10 requirements的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[2], 'objectNames')) && p('todo:15') && e('测试单15的待办'); // 获取动态11 12 13 14 15 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[2], 'objectNames')) && p('user:0') && e('guest'); // 获取动态11 12 13 14 15 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[2], 'relatedProjects')) && p('doc:13') && e('0'); // 获取动态11 12 13 14 15 relatedProjects的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[2], 'requirements')) && p() && e('0'); // 获取动态11 12 13 14 15 requirements的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[3], 'objectNames')) && p('caselib:19') && e('这是测试套件名称19'); // 获取动态16 17 18 19 20 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[3], 'objectNames')) && p('user:0') && e('guest'); // 获取动态16 17 18 19 20 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[3], 'relatedProjects')) && p('caselib:19') && e('0'); // 获取动态16 17 18 19 20 relatedProjects的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[3], 'requirements')) && p() && e('0'); // 获取动态16 17 18 19 20 requirements的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[4], 'objectNames')) && p('story:25') && e('用户需求25'); // 获取动态21 22 23 24 25 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[4], 'objectNames')) && p('user:0') && e('guest'); // 获取动态21 22 23 24 25 objectNames的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[4], 'relatedProjects')) && p('story:0') && e(''); // 获取动态21 22 23 24 25 relatedProjects的关联信息
|
||||
r($action->getRelatedDataByActionsTest($actions[4], 'requirements')) && p('25') && e('25'); // 获取动态21 22 23 24 25 requirements的关联信息
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getRelatedFields();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取objectType product objectId 1 actionType common extra 1 的动态信息 >> ,1,;0;0
|
||||
测试获取objectType story objectId 2 actionType extra extra 1 的动态信息 >> ,1,;11;101
|
||||
测试获取objectType productplan objectId 3 actionType opened extra 1 的动态信息 >> ,1,;0;0
|
||||
测试获取objectType release objectId 4 actionType created extra 1 的动态信息 >> ,41,;14;0
|
||||
测试获取objectType project objectId 5 actionType changed extra 11 的动态信息 >> ,,;5;0
|
||||
测试获取objectType task objectId 6 actionType edited extra 1 的动态信息 >> ,6,;16;106
|
||||
测试获取objectType build objectId 7 actionType assigned extra 1 的动态信息 >> ,7,;17;0
|
||||
测试获取objectType bug objectId 8 actionType closed extra 1 的动态信息 >> ,3,;13;103
|
||||
测试获取objectType testcase objectId 9 actionType deleted extra 1 的动态信息 >> ,3,;13;103
|
||||
测试获取objectType case objectId 10 actionType deletedfile extra 1 的动态信息 >> ,3,;13;103
|
||||
测试获取objectType testtask objectId 1 actionType editfile extra 1 的动态信息 >> ,1,;11;101
|
||||
测试获取objectType user objectId 12 actionType erased extra 1 的动态信息 >> ,0,;0;0
|
||||
测试获取objectType doc objectId 13 actionType undeleted extra 1 的动态信息 >> ,13,;0;0
|
||||
测试获取objectType doclib objectId 14 actionType hidden extra 1 的动态信息 >> ,14,;0;0
|
||||
测试获取objectType todo objectId 15 actionType commented extra 1 的动态信息 >> ,0,;0;0
|
||||
测试获取objectType branch objectId 16 actionType activated extra 1 的动态信息 >> ,0,;0;0
|
||||
测试获取objectType module objectId 17 actionType blocked extra 1 的动态信息 >> ,,0,,;0;0
|
||||
测试获取objectType testsuite objectId 18 actionType moved extra 1 的动态信息 >> ,0,;0;0
|
||||
测试获取objectType caselib objectId 19 actionType confirmed extra 1 的动态信息 >> ,0,;0;0
|
||||
测试获取objectType testreport objectId 20 actionType caseconfirmed extra 1 的动态信息 >> ,,;0;0
|
||||
测试获取objectType entry objectId 21 actionType bugconfirmed extra 1 的动态信息 >> ,0,;0;0
|
||||
测试获取objectType webhook objectId 22 actionType frombug extra 1 的动态信息 >> ,0,;0;0
|
||||
测试获取objectType review objectId 23 actionType started extra 1 的动态信息 >> ,0,;0;0
|
||||
测试获取objectType product objectId 24 actionType restarted extra 1 的动态信息 >> ,24,;0;0
|
||||
测试获取objectType story objectId 25 actionType delayed extra 1 的动态信息 >> ,7,;0;0
|
||||
测试获取objectType productplan objectId 26 actionType suspended extra 1 的动态信息 >> ,9,;0;0
|
||||
测试获取objectType release objectId 1 actionType recordestimate extra 1 的动态信息 >> ,1,;11;0
|
||||
测试获取objectType project objectId 28 actionType editestimate extra 33 的动态信息 >> ,8,18,98,;28;0
|
||||
测试获取objectType task objectId 29 actionType deleteestimate extra 1 的动态信息 >> ,29,;39;129
|
||||
测试获取objectType build objectId 1 actionType canceled extra 1 的动态信息 >> ,1,;11;0
|
||||
测试获取objectType bug objectId 31 actionType svncommited extra 1 的动态信息 >> ,11,;21;111
|
||||
测试获取objectType testcase objectId 32 actionType gitcommited extra 1 的动态信息 >> ,8,;18;108
|
||||
测试获取objectType case objectId 33 actionType finished extra 1 的动态信息 >> ,9,;19;109
|
||||
测试获取objectType testtask objectId 1 actionType paused extra 1 的动态信息 >> ,1,;11;101
|
||||
测试获取objectType user objectId 35 actionType verified extra 1 的动态信息 >> ,0,;0;0
|
||||
测试获取objectType doc objectId 36 actionType diff1 extra 1 的动态信息 >> ,36,;0;0
|
||||
测试获取objectType doclib objectId 37 actionType diff2 extra 1 的动态信息 >> ,37,;0;0
|
||||
测试获取objectType todo objectId 38 actionType diff3 extra 1 的动态信息 >> ,0,;0;0
|
||||
测试获取objectType branch objectId 39 actionType linked2bug extra 1 的动态信息 >> ,0,;0;0
|
||||
|
||||
*/
|
||||
$objectType = array('product', 'story', 'productplan', 'release', 'project', 'task', 'build', 'bug', 'testcase', 'case', 'testtask', 'user', 'doc', 'doclib', 'todo', 'branch', 'module', 'testsuite', 'caselib', 'testreport', 'entry', 'webhook', 'review');
|
||||
$objectId = array(1,2,3,4,5,6,7,8,9,10,1,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,1,28,29,1,31,32,33,1,35,36,37,38,39);
|
||||
$actionType = array('common', 'extra', 'opened', 'created', 'changed', 'edited', 'assigned', 'closed', 'deleted', 'deletedfile', 'editfile', 'erased', 'undeleted', 'hidden', 'commented', 'activated', 'blocked', 'moved', 'confirmed', 'caseconfirmed', 'bugconfirmed', 'frombug', 'started', 'restarted', 'delayed', 'suspended', 'recordestimate', 'editestimate', 'deleteestimate', 'canceled', 'svncommited', 'gitcommited', 'finished', 'paused', 'verified', 'diff1', 'diff2', 'diff3', 'linked2bug');
|
||||
$extra = array('1', '1', '1', '1', '11', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '33', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getRelatedFieldsTest($objectType[0], $objectId[0], $actionType[0], $extra[0])) && p('product;project;execution') && e(',1,;0;0'); // 测试获取objectType product objectId 1 actionType common extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[1], $objectId[1], $actionType[1], $extra[1])) && p('product;project;execution') && e(',1,;11;101'); // 测试获取objectType story objectId 2 actionType extra extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[2], $objectId[2], $actionType[2], $extra[2])) && p('product;project;execution') && e(',1,;0;0'); // 测试获取objectType productplan objectId 3 actionType opened extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[3], $objectId[3], $actionType[3], $extra[3])) && p('product;project;execution') && e(',41,;14;0'); // 测试获取objectType release objectId 4 actionType created extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[4], $objectId[4], $actionType[4], $extra[4])) && p('product;project;execution') && e(',,;5;0'); // 测试获取objectType project objectId 5 actionType changed extra 11 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[5], $objectId[5], $actionType[5], $extra[5])) && p('product;project;execution') && e(',6,;16;106'); // 测试获取objectType task objectId 6 actionType edited extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[6], $objectId[6], $actionType[6], $extra[6])) && p('product;project;execution') && e(',7,;17;0'); // 测试获取objectType build objectId 7 actionType assigned extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[7], $objectId[7], $actionType[7], $extra[7])) && p('product;project;execution') && e(',3,;13;103'); // 测试获取objectType bug objectId 8 actionType closed extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[8], $objectId[8], $actionType[8], $extra[8])) && p('product;project;execution') && e(',3,;13;103'); // 测试获取objectType testcase objectId 9 actionType deleted extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[9], $objectId[9], $actionType[9], $extra[9])) && p('product;project;execution') && e(',3,;13;103'); // 测试获取objectType case objectId 10 actionType deletedfile extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[10], $objectId[10], $actionType[10], $extra[10])) && p('product;project;execution') && e(',1,;11;101'); // 测试获取objectType testtask objectId 1 actionType editfile extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[11], $objectId[11], $actionType[11], $extra[11])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType user objectId 12 actionType erased extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[12], $objectId[12], $actionType[12], $extra[12])) && p('product;project;execution') && e(',13,;0;0'); // 测试获取objectType doc objectId 13 actionType undeleted extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[13], $objectId[13], $actionType[13], $extra[13])) && p('product;project;execution') && e(',14,;0;0'); // 测试获取objectType doclib objectId 14 actionType hidden extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[14], $objectId[14], $actionType[14], $extra[14])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType todo objectId 15 actionType commented extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[15], $objectId[15], $actionType[15], $extra[15])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType branch objectId 16 actionType activated extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[16], $objectId[16], $actionType[16], $extra[16])) && p('product;project;execution') && e(',,0,,;0;0'); // 测试获取objectType module objectId 17 actionType blocked extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[17], $objectId[17], $actionType[17], $extra[17])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType testsuite objectId 18 actionType moved extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[18], $objectId[18], $actionType[18], $extra[18])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType caselib objectId 19 actionType confirmed extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[19], $objectId[19], $actionType[19], $extra[19])) && p('product;project;execution') && e(',,;0;0'); // 测试获取objectType testreport objectId 20 actionType caseconfirmed extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[20], $objectId[20], $actionType[20], $extra[20])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType entry objectId 21 actionType bugconfirmed extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[21], $objectId[21], $actionType[21], $extra[21])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType webhook objectId 22 actionType frombug extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[22], $objectId[22], $actionType[22], $extra[22])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType review objectId 23 actionType started extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[0], $objectId[23], $actionType[23], $extra[23])) && p('product;project;execution') && e(',24,;0;0'); // 测试获取objectType product objectId 24 actionType restarted extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[1], $objectId[24], $actionType[24], $extra[24])) && p('product;project;execution') && e(',7,;0;0'); // 测试获取objectType story objectId 25 actionType delayed extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[2], $objectId[25], $actionType[25], $extra[25])) && p('product;project;execution') && e(',9,;0;0'); // 测试获取objectType productplan objectId 26 actionType suspended extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[3], $objectId[26], $actionType[26], $extra[26])) && p('product;project;execution') && e(',1,;11;0'); // 测试获取objectType release objectId 1 actionType recordestimate extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[4], $objectId[27], $actionType[27], $extra[27])) && p('product;project;execution') && e(',8,18,98,;28;0'); // 测试获取objectType project objectId 28 actionType editestimate extra 33 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[5], $objectId[28], $actionType[28], $extra[28])) && p('product;project;execution') && e(',29,;39;129'); // 测试获取objectType task objectId 29 actionType deleteestimate extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[6], $objectId[29], $actionType[29], $extra[29])) && p('product;project;execution') && e(',1,;11;0'); // 测试获取objectType build objectId 1 actionType canceled extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[7], $objectId[30], $actionType[30], $extra[30])) && p('product;project;execution') && e(',11,;21;111'); // 测试获取objectType bug objectId 31 actionType svncommited extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[8], $objectId[31], $actionType[31], $extra[31])) && p('product;project;execution') && e(',8,;18;108'); // 测试获取objectType testcase objectId 32 actionType gitcommited extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[9], $objectId[32], $actionType[32], $extra[32])) && p('product;project;execution') && e(',9,;19;109'); // 测试获取objectType case objectId 33 actionType finished extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[10], $objectId[33], $actionType[33], $extra[33])) && p('product;project;execution') && e(',1,;11;101'); // 测试获取objectType testtask objectId 1 actionType paused extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[11], $objectId[34], $actionType[34], $extra[34])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType user objectId 35 actionType verified extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[12], $objectId[35], $actionType[35], $extra[35])) && p('product;project;execution') && e(',36,;0;0'); // 测试获取objectType doc objectId 36 actionType diff1 extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[13], $objectId[36], $actionType[36], $extra[36])) && p('product;project;execution') && e(',37,;0;0'); // 测试获取objectType doclib objectId 37 actionType diff2 extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[14], $objectId[37], $actionType[37], $extra[37])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType todo objectId 38 actionType diff3 extra 1 的动态信息
|
||||
r($action->getRelatedFieldsTest($objectType[15], $objectId[38], $actionType[38], $extra[38])) && p('product;project;execution') && e(',0,;0;0'); // 测试获取objectType branch objectId 39 actionType linked2bug extra 1 的动态信息
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getTrashes();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
查询objectType all type all id desc排序的回收站信息 >> testsuite,,这是测试套件名称87;story,,软件需求48
|
||||
查询objectType all type all id desc排序的回收站信息 >> story,,软件需求48;testsuite,,这是测试套件名称87
|
||||
查询objectType all type hidden id asc排序的回收站信息 >> testcase,,这个是测试用例9
|
||||
查询objectType all type hidden id asc排序的回收站信息 >> testcase,,这个是测试用例9
|
||||
查询objectType story type all id asc排序的回收站信息 >> story,,软件需求48
|
||||
查询objectType testcase hidden id asc排序的回收站信息 >> testcase,,这个是测试用例9
|
||||
|
||||
*/
|
||||
|
||||
$objectTypeList = array('all', 'story', 'testcase');
|
||||
$typeList = array('all', 'hidden');
|
||||
$orderBy = array('id_desc', 'id_asc');
|
||||
$pager = null;
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getTrashesTest($objectTypeList[0], $typeList[0], $orderBy[0], $pager)) && p('0:objectType,objectId,objectName;1:objectType,objectId,objectName') && e('testsuite,,这是测试套件名称87;story,,软件需求48'); // 查询objectType all type all id desc排序的回收站信息
|
||||
r($action->getTrashesTest($objectTypeList[0], $typeList[0], $orderBy[1], $pager)) && p('0:objectType,objectId,objectName;1:objectType,objectId,objectName') && e('story,,软件需求48;testsuite,,这是测试套件名称87'); // 查询objectType all type all id desc排序的回收站信息
|
||||
r($action->getTrashesTest($objectTypeList[0], $typeList[1], $orderBy[0], $pager)) && p('0:objectType,objectId,objectName') && e('testcase,,这个是测试用例9'); // 查询objectType all type hidden id asc排序的回收站信息
|
||||
r($action->getTrashesTest($objectTypeList[0], $typeList[1], $orderBy[1], $pager)) && p('0:objectType,objectId,objectName') && e('testcase,,这个是测试用例9'); // 查询objectType all type hidden id asc排序的回收站信息
|
||||
r($action->getTrashesTest($objectTypeList[1], $typeList[0], $orderBy[0], $pager)) && p('0:objectType,objectId,objectName') && e('story,,软件需求48'); // 查询objectType story type all id asc排序的回收站信息
|
||||
r($action->getTrashesTest($objectTypeList[2], $typeList[1], $orderBy[0], $pager)) && p('0:objectType,objectId,objectName') && e('testcase,,这个是测试用例9'); // 查询objectType testcase hidden id asc排序的回收站信息
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getTrashesBySearch();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
搜索objectType all, type all, queryID myQueryID, orderBy id_desc的回收站信息 >> 0
|
||||
搜索objectType story, type all, queryID myQueryID, orderBy id_desc的回收站信息 >> 48,story
|
||||
搜索objectType story, type all, queryID 2, orderBy id_asc的回收站信息 >> 48,story
|
||||
搜索objectType story, type hidden, queryID myQueryID, orderBy id_desc的回收站信息 >> 0
|
||||
搜索objectType testcase, type all, queryID 0, orderBy id_asc的回收站信息 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$objectTypeList = array('all', 'story', 'testcase');
|
||||
$typeList = array('all', 'hidden');
|
||||
$queryIdList = array('myQueryID', '0', '2');
|
||||
$orderBy = array('id_desc', 'id_asc');
|
||||
$pager = null;
|
||||
|
||||
$action = new actionTest();
|
||||
r($action->getTrashesBySearchTest($objectTypeList[0], $typeList[0], $queryIdList[0], $orderBy[0], $pager)) && p() && e('0'); // 搜索objectType all, type all, queryID myQueryID, orderBy id_desc的回收站信息
|
||||
r($action->getTrashesBySearchTest($objectTypeList[1], $typeList[0], $queryIdList[0], $orderBy[0], $pager)) && p('48:id,objectType') && e('48,story'); // 搜索objectType story, type all, queryID myQueryID, orderBy id_desc的回收站信息
|
||||
r($action->getTrashesBySearchTest($objectTypeList[1], $typeList[0], $queryIdList[1], $orderBy[1], $pager)) && p('48:id,objectType') && e('48,story'); // 搜索objectType story, type all, queryID 2, orderBy id_asc的回收站信息
|
||||
r($action->getTrashesBySearchTest($objectTypeList[1], $typeList[1], $queryIdList[0], $orderBy[0], $pager)) && p() && e('0'); // 搜索objectType story, type hidden, queryID myQueryID, orderBy id_desc的回收站信息
|
||||
r($action->getTrashesBySearchTest($objectTypeList[2], $typeList[0], $queryIdList[0], $orderBy[1], $pager)) && p() && e('0'); // 搜索objectType testcase, type all, queryID 0, orderBy id_asc的回收站信息
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getTrashObjectTypes();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
查询type all 的对象类型列表 >> story
|
||||
查询type all 的对象类型列表 >> testcase
|
||||
|
||||
*/
|
||||
|
||||
$typeList = array('all', 'hidden');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getTrashObjectTypesTest($typeList[0])) && p('story:objectType') && e('story'); // 查询type all 的对象类型列表
|
||||
r($action->getTrashObjectTypesTest($typeList[1])) && p('testcase:objectType') && e('testcase'); // 查询type all 的对象类型列表
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getUnreadActions();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取ID为空的动态 >> 0
|
||||
测试获取ID为0的动态 >> 0
|
||||
测试获取ID为1的动态 >> 0
|
||||
测试获取ID不存在的动态 >> 0
|
||||
测试获取ID是数组的动态 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$actionIdList = array('', 0, '1', '1000');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getUnreadActionsTest($actionIdList[0])) && p() && e('0'); // 测试获取ID为空的动态
|
||||
r($action->getUnreadActionsTest($actionIdList[1])) && p() && e('0'); // 测试获取ID为0的动态
|
||||
r($action->getUnreadActionsTest($actionIdList[2])) && p() && e('0'); // 测试获取ID为1的动态
|
||||
r($action->getUnreadActionsTest($actionIdList[3])) && p() && e('0'); // 测试获取ID不存在的动态
|
||||
r($action->getUnreadActionsTest($actionIdList)) && p() && e('0'); // 测试获取ID是数组的动态
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->hasPreOrNext();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试传入空参数 >> 1
|
||||
测试空日期之前是否有动态 >> 0
|
||||
测试空日期之后是否有动态 >> 1
|
||||
测试今天之前是否有动态 >> 1
|
||||
测试今天之后是否有动态 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
$dateList = array('', 'today');
|
||||
$directionList = array('', 'next', 'pre');
|
||||
r($action->hasPreOrNextTest($dateList[0], $directionList[0])) && p() && e('1'); // 测试传入空参数
|
||||
r($action->hasPreOrNextTest($dateList[0], $directionList[1])) && p() && e('0'); // 测试空日期之前是否有动态
|
||||
r($action->hasPreOrNextTest($dateList[0], $directionList[2])) && p() && e('1'); // 测试空日期之后是否有动态
|
||||
r($action->hasPreOrNextTest($dateList[1], $directionList[1])) && p() && e('1'); // 测试今天之前是否有动态
|
||||
r($action->hasPreOrNextTest($dateList[1], $directionList[2])) && p() && e('0'); // 测试今天之后是否有动态
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->hideAll();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
隐藏回收站全部信息 >> 2;2;2
|
||||
|
||||
*/
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->hideAllTest()) && p('0:extra;1:extra;2:extra') && e('2;2;2'); // 隐藏回收站全部信息
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->hideOne();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
隐藏action 28 >> 2
|
||||
隐藏action 87 >> 2
|
||||
隐藏已隐藏action 9 >> 2
|
||||
隐藏非删除action 1 >> 1
|
||||
|
||||
*/
|
||||
$actionIDList = array('48', '87', '9', '1');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->hideOneTest($actionIDList[0])) && p('extra') && e('2'); // 隐藏action 28
|
||||
r($action->hideOneTest($actionIDList[1])) && p('extra') && e('2'); // 隐藏action 87
|
||||
r($action->hideOneTest($actionIDList[2])) && p('extra') && e('2'); // 隐藏已隐藏action 9
|
||||
r($action->hideOneTest($actionIDList[3])) && p('extra') && e('1'); // 隐藏非删除action 1
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->logHistory();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试新增actionID 10001 历史记录 >> name,变更前名称,变更后名称;code,变更前编号,变更后编号
|
||||
测试新增actionID 10002 历史记录 >> assignedTo,admin,test1
|
||||
测试新增actionID 10003 历史记录 >> name,name1,name2
|
||||
测试新增actionID 10004 历史记录 >> code,code1,code2
|
||||
测试新增actionID 10005 历史记录 >> assignedTo,test2,test1
|
||||
|
||||
*/
|
||||
|
||||
$actionIDList = array('10001', '10002', '10003', '10004', '10005');
|
||||
|
||||
$changes1[0] = array('field' => 'name', 'old' => '变更前名称', 'new' => '变更后名称');
|
||||
$changes1[1] = array('field' => 'code', 'old' => '变更前编号', 'new' => '变更后编号');
|
||||
$changes2[0] = array('field' => 'assignedTo', 'old' => 'admin', 'new' => 'test1');
|
||||
$changes3[0] = array('field' => 'name', 'old' => 'name1', 'new' => 'name2');
|
||||
$changes4[0] = array('field' => 'code', 'old' => 'code1', 'new' => 'code2');
|
||||
$changes5[0] = array('field' => 'assignedTo', 'old' => 'test2', 'new' => 'test1');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->logHistoryTest($actionIDList[0], $changes1)) && p('0:field,old,new;1:field,old,new') && e('name,变更前名称,变更后名称;code,变更前编号,变更后编号'); // 测试新增actionID 10001 历史记录
|
||||
r($action->logHistoryTest($actionIDList[1], $changes2)) && p('0:field,old,new') && e('assignedTo,admin,test1'); // 测试新增actionID 10002 历史记录
|
||||
r($action->logHistoryTest($actionIDList[2], $changes3)) && p('0:field,old,new') && e('name,name1,name2'); // 测试新增actionID 10003 历史记录
|
||||
r($action->logHistoryTest($actionIDList[3], $changes4)) && p('0:field,old,new') && e('code,code1,code2'); // 测试新增actionID 10004 历史记录
|
||||
r($action->logHistoryTest($actionIDList[4], $changes5)) && p('0:field,old,new') && e('assignedTo,test2,test1'); // 测试新增actionID 10005 历史记录
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->processDynamicForAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试处理空数据 >> 0
|
||||
处理所有动态 >> admin,admin,/home/z/tmp/1.png
|
||||
|
||||
*/
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
$dynamics = $tester->dao->select('*')->from(TABLE_ACTION)->fetchAll();
|
||||
|
||||
r($action->processDynamicForAPITest(array())) && p() && e('0'); // 测试处理空数据
|
||||
r($action->processDynamicForAPITest($dynamics)) && p('actor:account,realname,avatar') && e('admin,admin,/home/z/tmp/1.png'); // 处理所有动态
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->processProjectActions();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试计算action 1 2 3 4 5 的项目动态 >> 5
|
||||
测试计算action 26 27 28 29 30 的项目动态 >> 28
|
||||
测试计算action 51 52 53 54 55 的项目动态 >> 51
|
||||
测试计算action 71 72 73 74 75 的项目动态 >> 74
|
||||
测试计算action 96 97 98 99 100 的项目动态 >> 97
|
||||
测试计算action 5 28 51 74 97 的项目动态 >> 5,28,51,74,97
|
||||
|
||||
*/
|
||||
|
||||
$actions = array('1,2,3,4,5', '26,27,28,29,30', '51,52,53,54,55', '71,72,73,74,75', '96,97,98,99,100', '5,28,51,74,97');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->processProjectActionsTest($actions[0])) && p() && e('5'); // 测试计算action 1 2 3 4 5 的项目动态
|
||||
r($action->processProjectActionsTest($actions[1])) && p() && e('28'); // 测试计算action 26 27 28 29 30 的项目动态
|
||||
r($action->processProjectActionsTest($actions[2])) && p() && e('51'); // 测试计算action 51 52 53 54 55 的项目动态
|
||||
r($action->processProjectActionsTest($actions[3])) && p() && e('74'); // 测试计算action 71 72 73 74 75 的项目动态
|
||||
r($action->processProjectActionsTest($actions[4])) && p() && e('97'); // 测试计算action 96 97 98 99 100 的项目动态
|
||||
r($action->processProjectActionsTest($actions[5])) && p() && e('5,28,51,74,97'); // 测试计算action 5 28 51 74 97 的项目动态
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->read();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试对action 1 进行阅读操作 >> product,1,1
|
||||
测试对action 2 进行阅读操作 >> story,2,1
|
||||
测试对action 3 进行阅读操作 >> productplan,3,1
|
||||
测试对action 4 进行阅读操作 >> release,4,1
|
||||
测试对action 5 进行阅读操作 >> project,5,1
|
||||
|
||||
*/
|
||||
|
||||
$objectType = array('product', 'story', 'productplan', 'release', 'project');
|
||||
$objectID = array(1,2,3,4,5);
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->readTest($objectType[0], $objectID[0])) && p('0:objectType,objectID,read') && e('product,1,1'); // 测试对action 1 进行阅读操作
|
||||
r($action->readTest($objectType[1], $objectID[1])) && p('0:objectType,objectID,read') && e('story,2,1'); // 测试对action 2 进行阅读操作
|
||||
r($action->readTest($objectType[2], $objectID[2])) && p('0:objectType,objectID,read') && e('productplan,3,1'); // 测试对action 3 进行阅读操作
|
||||
r($action->readTest($objectType[3], $objectID[3])) && p('0:objectType,objectID,read') && e('release,4,1'); // 测试对action 4 进行阅读操作
|
||||
r($action->readTest($objectType[4], $objectID[4])) && p('0:objectType,objectID,read') && e('project,5,1'); // 测试对action 5 进行阅读操作
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b');
|
||||
$execution->type->range('project,stage{4}');
|
||||
$execution->project->range('0,1{4}');
|
||||
$execution->parent->range('0,1,2,3,1');
|
||||
$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`");
|
||||
$execution->status->range('doing,doing,doing,closed,suspended');
|
||||
$execution->openedBy->range('admin,user1');
|
||||
$execution->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->deleted->range('0,1{4}');
|
||||
$execution->gen(5);
|
||||
|
||||
$action = zdTable('action');
|
||||
$action->id->range('1-4');
|
||||
$action->objectType->range('execution');
|
||||
$action->objectID->range('2,3,4,5');
|
||||
$action->project->range('1');
|
||||
$action->actor->range('admin');
|
||||
$action->action->range('deleted');
|
||||
$action->extra->range('1');
|
||||
$action->gen(4);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->restoreStages();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试还原id为2和3的阶段 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
$hasDeleted = $action->restoreStagesTest(array(2 => 2, 3 => 3), array(1, 2));
|
||||
|
||||
r($hasDeleted[2]) && p('extra') && e('0'); // 测试还原id为2和3的阶段
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->saveIndex();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试保存空数据 >> 1
|
||||
测试保存stroyId为0, action为空的数据 >> 1
|
||||
测试保存stroyId为1, action为空的数据 >> 1
|
||||
测试保存stroyId为100000, action为空的数据 >> 1
|
||||
测试保存stroyId为0, action为created的数据 >> 1
|
||||
测试保存stroyId为1, action为created的数据 >> 1
|
||||
测试保存stroyId为100000, action为created的数据 >> 1
|
||||
测试保存不存在类型的数据 >> 1
|
||||
|
||||
*/
|
||||
|
||||
$objectTypeList = array('', 'stroy', 'test');
|
||||
$objectIdList = array(0, 1, 100000);
|
||||
$actionTypeList = array('', 'created', 'tested');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->saveIndexTest($objectTypeList[0], $objectIdList[0], $actionTypeList[0])) && p() && e('1'); // 测试保存空数据
|
||||
r($action->saveIndexTest($objectTypeList[1], $objectIdList[0], $actionTypeList[0])) && p() && e('1'); // 测试保存stroyId为0, action为空的数据
|
||||
r($action->saveIndexTest($objectTypeList[1], $objectIdList[1], $actionTypeList[0])) && p() && e('1'); // 测试保存stroyId为1, action为空的数据
|
||||
r($action->saveIndexTest($objectTypeList[1], $objectIdList[2], $actionTypeList[0])) && p() && e('1'); // 测试保存stroyId为100000, action为空的数据
|
||||
r($action->saveIndexTest($objectTypeList[1], $objectIdList[0], $actionTypeList[1])) && p() && e('1'); // 测试保存stroyId为0, action为created的数据
|
||||
r($action->saveIndexTest($objectTypeList[1], $objectIdList[1], $actionTypeList[1])) && p() && e('1'); // 测试保存stroyId为1, action为created的数据
|
||||
r($action->saveIndexTest($objectTypeList[1], $objectIdList[2], $actionTypeList[1])) && p() && e('1'); // 测试保存stroyId为100000, action为created的数据
|
||||
r($action->saveIndexTest($objectTypeList[2], $objectIdList[2], $actionTypeList[2])) && p() && e('1'); // 测试保存不存在类型的数据
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->transformActions();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试转换动态1 2 3 4 5 >> 0
|
||||
测试转换动态26 27 28 29 30 >> 1.1;;项目18;开发任务39;
|
||||
测试转换动态51 52 53 54 55 >> 项目41;开发任务62;;BUG54;这个是测试用例55
|
||||
测试转换动态71 72 73 74 75 >> 用户需求71;;;项目64;开发任务85
|
||||
测试转换动态96 97 98 99 100 >> ;项目87;开发任务108;;BUG10
|
||||
|
||||
*/
|
||||
$actions = array('1,2,3,4,5', '26,27,28,29,30', '51,52,53,54,55', '71,72,73,74,75', '96,97,98,99,100');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->transformActionsTest($actions[0])) && p('1:objectName;2:objectName;3:objectName;4:objectName;5:objectName') && e('0'); // 0
|
||||
r($action->transformActionsTest($actions[1])) && p('26:objectName;27:objectName;28:objectName;29:objectName;30:objectName') && e('1.1;;项目18;开发任务39;'); // 测试转换动态26 27 28 29 30
|
||||
r($action->transformActionsTest($actions[2])) && p('51:objectName;52:objectName;53:objectName;54:objectName;55:objectName') && e('项目41;开发任务62;;BUG54;这个是测试用例55'); // 测试转换动态51 52 53 54 55
|
||||
r($action->transformActionsTest($actions[3])) && p('71:objectName;72:objectName;73:objectName;74:objectName;75:objectName') && e('用户需求71;;;项目64;开发任务85'); // 测试转换动态71 72 73 74 75
|
||||
r($action->transformActionsTest($actions[4])) && p('96:objectName;97:objectName;98:objectName;99:objectName;100:objectName') && e(';项目87;开发任务108;;BUG10'); // 测试转换动态96 97 98 99 100
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->undelete();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试还原action 28 >> 0
|
||||
测试还原action 87 >> 0
|
||||
测试还原action 9 >> 0
|
||||
测试还原未删除action 1 >> 1
|
||||
|
||||
*/
|
||||
$actionIDList = array('48', '87', '9', '1');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->undeleteTest($actionIDList[0])) && p('extra') && e('0'); // 测试还原action 28
|
||||
r($action->undeleteTest($actionIDList[1])) && p('extra') && e('0'); // 测试还原action 87
|
||||
r($action->undeleteTest($actionIDList[2])) && p('extra') && e('0'); // 测试还原action 9
|
||||
r($action->undeleteTest($actionIDList[3])) && p('extra') && e('1'); // 测试还原未删除action 1
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->updateComment();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试更新action 1的备注 >> 备注1
|
||||
测试更新action 2的备注 >> 备注2
|
||||
测试更新action 3的备注 >> 备注3
|
||||
测试更新action 4的备注 >> 备注4
|
||||
测试更新action 5的备注 >> 备注5
|
||||
|
||||
*/
|
||||
$actionIDList = array('1', '2', '3', '4', '5');
|
||||
$commentList = array('备注1', '备注2', '备注3', '备注4', '备注5');
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->updateCommentTest($actionIDList[0], $commentList[0])) && p('comment') && e('备注1'); // 测试更新action 1的备注
|
||||
r($action->updateCommentTest($actionIDList[1], $commentList[1])) && p('comment') && e('备注2'); // 测试更新action 2的备注
|
||||
r($action->updateCommentTest($actionIDList[2], $commentList[2])) && p('comment') && e('备注3'); // 测试更新action 3的备注
|
||||
r($action->updateCommentTest($actionIDList[3], $commentList[3])) && p('comment') && e('备注4'); // 测试更新action 4的备注
|
||||
r($action->updateCommentTest($actionIDList[4], $commentList[4])) && p('comment') && e('备注5'); // 测试更新action 5的备注
|
||||
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
class adminTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
global $config;
|
||||
global $app;
|
||||
$this->objectModel = $tester->loadModel('admin');
|
||||
$this->user = $tester->loadModel('user');
|
||||
$this->communityConfig = $app->loadConfig('community');
|
||||
$this->adminConfig = $config->admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post data form API.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $formvars
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function postAPITest()
|
||||
{
|
||||
$apiConfig = $this->objectModel->getApiConfig();
|
||||
$apiURL = $this->adminConfig->apiRoot . "/user-apiRegister.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest&{$apiConfig->sessionVar}={$apiConfig->sessionID}";
|
||||
|
||||
$objects = $this->objectModel->postAPI($apiURL);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get status of zentaopms.
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getStatOfPMSTest()
|
||||
{
|
||||
$objects = $this->objectModel->getStatOfPMS();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getStatOfCompanyTest($companyID)
|
||||
{
|
||||
$objects = $this->objectModel->getStatOfCompany($companyID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getStatOfSysTest()
|
||||
{
|
||||
$objects = $this->objectModel->getStatOfSys();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function registerByAPITest()
|
||||
{
|
||||
$objects = $this->objectModel->registerByAPI();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Login zentao by API.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function bindByAPITest($param)
|
||||
{
|
||||
$_POST = $param;
|
||||
$objects = $this->objectModel->bindByAPI();
|
||||
$objects = json_decode($objects);
|
||||
unset($_POST);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getSecretKeyTest()
|
||||
{
|
||||
$objects = $this->objectModel->getSecretKey();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function sendCodeByAPITest($type)
|
||||
{
|
||||
$objects = $this->objectModel->sendCodeByAPI($type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function certifyByAPITest($type)
|
||||
{
|
||||
$objects = $this->objectModel->certifyByAPI($type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function setCompanyByAPITest()
|
||||
{
|
||||
$objects = $this->objectModel->setCompanyByAPI();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get signature.
|
||||
*
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSignatureTest()
|
||||
{
|
||||
$params['u'] = $this->communityConfig;
|
||||
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequet';
|
||||
|
||||
$apiConfig = $this->objectModel->getApiConfig();
|
||||
$params[$apiConfig->sessionVar] = $apiConfig->sessionID;
|
||||
|
||||
$objects = $this->objectModel->getSignature($params);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($objects){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getApiConfigTest()
|
||||
{
|
||||
$objects = $this->objectModel->getApiConfig();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get register information.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getRegisterInfoTest()
|
||||
{
|
||||
$objects = $this->objectModel->getRegisterInfo();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Check weak.
|
||||
*
|
||||
* @param object $user
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function checkWeakTest($account)
|
||||
{
|
||||
$user = $this->user->getById($account);
|
||||
$objects = $this->objectModel->checkWeak($user);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getMenuKeyTest($moduleName, $methodName, $params = array())
|
||||
{
|
||||
global $app;
|
||||
$app->rawModule = $moduleName;
|
||||
$app->rawMethod = $methodName;
|
||||
$app->rawParams = $params;
|
||||
|
||||
$menuKey = $this->objectModel->getMenuKey();
|
||||
return empty($menuKey) ? 'null' : $menuKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the authorized link
|
||||
*
|
||||
* @param mixed $menuKey
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getHasPrivLinkTest($menuKey)
|
||||
{
|
||||
global $lang;
|
||||
$subMenuList = $lang->admin->menuList->$menuKey['subMenu'];
|
||||
$link = array();
|
||||
foreach($subMenuList as $subMenu)
|
||||
{
|
||||
$link = $this->objectModel->getHasPrivLink($subMenu);
|
||||
if(!empty($link)) return $link;
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
}
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->bindByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> success;wxm11,j8a5qCRTleJh9Gv4
|
||||
错误密码测试 >> fail;登录失败,请检查您的用户名或密码是否填写正确。
|
||||
post数据为空测试 >> fail;登录失败,请检查您的用户名或密码是否填写正确。
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
$paramInfo = array('account' => 'wxm11', 'password' => '123qweasd', 'sn' => 'c8aa3269e181f2b9258ce96625de1497', 'site' => 'http://zentaopmsdemo.com');
|
||||
$errorPwd = array('account' => 'wxm11', 'password' => '123', 'sn' => 'c8aa3269e181f2b9258ce96625de1497', 'site' => 'http://zentaopmsdemo.com');
|
||||
$emptyPost = array();
|
||||
|
||||
r($admin->bindByAPITest($errorPwd)) && p('result;message') && e('fail;登录失败,请检查您的用户名或密码是否填写正确。'); //错误密码测试
|
||||
r($admin->bindByAPITest($emptyPost)) && p('result;message') && e('fail;登录失败,请检查您的用户名或密码是否填写正确。'); //post数据为空测试
|
||||
r($admin->bindByAPITest($paramInfo)) && p('result;data:account,private') && e('success;wxm11,j8a5qCRTleJh9Gv4'); //正常测试
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->certifyByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->certifyByAPITest()) && p() && e();
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel::checkInternet();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
验证网络连接 >> 1
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$tester->loadModel('admin');
|
||||
$result = (int)$tester->admin->checkInternet();
|
||||
|
||||
r($result) && p() && e('1'); // 验证网络连接
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->checkWeak();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> 0
|
||||
|
||||
*/
|
||||
$account = 'admin';
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->checkWeakTest($account)) && p() && e('0'); //正常测试
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel::fetchAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正确的API地址 >> 1
|
||||
错误的API地址 >> 0
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$tester->loadModel('admin');
|
||||
|
||||
$realURL = 'https://www.zentao.net/publicclass.json';
|
||||
$invalidURL = 'https://test.zentao.net/publicclass.json';
|
||||
|
||||
$result1 = (int)!empty($tester->admin->fetchAPI($realURL));
|
||||
$result2 = (int)$tester->admin->fetchAPI($invalidURL);
|
||||
|
||||
r($result1) && p() && e('1'); // 正确的API地址
|
||||
r($result2) && p() && e('0'); // 错误的API地址
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getApiConfig();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getApiConfigTest()) && p() && e();
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel::getExtensionsByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
查询断网情况插件数量 >> 3
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$tester->loadModel('admin');
|
||||
$result = $tester->admin->getExtensionsByAPI('extension', 6, false);
|
||||
|
||||
r(count($result)) && p() && e('3'); // 查询断网情况插件数量
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getHasPrivLink();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取功能配置第一个有权限访问的链接 >> custom,mode
|
||||
获取人员管理第一个有权限访问的链接 >> dept,browse
|
||||
获取模型配置第一个有权限访问的链接 >> custom,required
|
||||
获取功能配置第一个有权限访问的链接 >> custom,set
|
||||
获取通知设置第一个有权限访问的链接 >> mail,edit
|
||||
获取二次开发第一个有权限访问的链接 >> dev,api
|
||||
|
||||
*/
|
||||
$adminTester = new adminTest();
|
||||
|
||||
$subMenu['system'] = $lang->admin->menuList->system['subMenu'];
|
||||
$menuList = array('system', 'user', 'model', 'feature', 'message', 'dev');
|
||||
r($adminTester->getHasPrivLinkTest($menuList[0])) && p('0,1') && e('custom,mode'); // 获取功能配置第一个有权限访问的链接
|
||||
r($adminTester->getHasPrivLinkTest($menuList[1])) && p('0,1') && e('dept,browse'); // 获取人员管理第一个有权限访问的链接
|
||||
r($adminTester->getHasPrivLinkTest($menuList[2])) && p('0,1') && e('custom,required'); // 获取模型配置第一个有权限访问的链接
|
||||
r($adminTester->getHasPrivLinkTest($menuList[3])) && p('0,1') && e('custom,set'); // 获取功能配置第一个有权限访问的链接
|
||||
r($adminTester->getHasPrivLinkTest($menuList[4])) && p('0,1') && e('mail,edit'); // 获取通知设置第一个有权限访问的链接
|
||||
r($adminTester->getHasPrivLinkTest($menuList[5])) && p('0,1') && e('dev,api'); // 获取二次开发第一个有权限访问的链接
|
||||
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getMenuKey();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
访问后台页面 >> null
|
||||
访问备份页面 >> system
|
||||
访问定时列表页面 >> system
|
||||
访问定时创建页面 >> system
|
||||
访问部门页面 >> user
|
||||
访问编辑用户页面 >> user
|
||||
访问权限列表页面 >> user
|
||||
访问功能设置页面 >> switch
|
||||
访问项目必填项页面 >> model
|
||||
访问阶段类型页面 >> model
|
||||
访问检查对象页面 >> model
|
||||
访问自定义待办页面 >> feature
|
||||
访问自定义产品页面 >> feature
|
||||
访问自定义看板页面 >> feature
|
||||
访问模板类型页面 >> template
|
||||
访问文档模板页面 >> template
|
||||
访问文档目录页面 >> template
|
||||
访问发信配置页面 >> message
|
||||
访问Webhook页面 >> message
|
||||
访问短信页面 >> message
|
||||
访问浏览器页面 >> message
|
||||
访问信息配置页面 >> message
|
||||
访问插件页面 >> extension
|
||||
访问API页面 >> dev
|
||||
访问数据库页面 >> dev
|
||||
访问编辑器页面 >> dev
|
||||
访问应用页面 >> dev
|
||||
访问数据导入页面 >> convert
|
||||
|
||||
*/
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getMenuKeyTest('admin', 'index')) && p() && e('null'); //访问后台页面
|
||||
r($admin->getMenuKeyTest('backup', 'index')) && p() && e('system'); //访问备份页面
|
||||
r($admin->getMenuKeyTest('cron', 'index')) && p() && e('system'); //访问定时列表页面
|
||||
r($admin->getMenuKeyTest('cron', 'create')) && p() && e('system'); //访问定时创建页面
|
||||
r($admin->getMenuKeyTest('dept', 'browse')) && p() && e('user'); //访问部门页面
|
||||
r($admin->getMenuKeyTest('user', 'edit')) && p() && e('user'); //访问编辑用户页面
|
||||
r($admin->getMenuKeyTest('group', 'browse')) && p() && e('user'); //访问权限列表页面
|
||||
r($admin->getMenuKeyTest('admin', 'setmodule')) && p() && e('switch'); //访问功能设置页面
|
||||
r($admin->getMenuKeyTest('custom', 'required', array('module' => 'project'))) && p() && e('model'); //访问项目必填项页面
|
||||
r($admin->getMenuKeyTest('stage', 'settype')) && p() && e('model'); //访问阶段类型页面
|
||||
r($admin->getMenuKeyTest('auditcl', 'scrumbrowse')) && p() && e('model'); //访问检查对象页面
|
||||
r($admin->getMenuKeyTest('custom', 'set', array('module' => 'todo'))) && p() && e('feature'); //访问自定义待办页面
|
||||
r($admin->getMenuKeyTest('custom', 'product')) && p() && e('feature'); //访问自定义产品页面
|
||||
r($admin->getMenuKeyTest('custom', 'kanban')) && p() && e('feature'); //访问自定义看板页面
|
||||
r($admin->getMenuKeyTest('custom', 'set', array('module' => 'baseline'))) && p() && e('template'); //访问模板类型页面
|
||||
r($admin->getMenuKeyTest('baseline', 'template')) && p() && e('template'); //访问文档模板页面
|
||||
r($admin->getMenuKeyTest('baseline', 'catalog')) && p() && e('template'); //访问文档目录页面
|
||||
r($admin->getMenuKeyTest('mail', 'detect')) && p() && e('message'); //访问发信配置页面
|
||||
r($admin->getMenuKeyTest('webhook', 'browse')) && p() && e('message'); //访问Webhook页面
|
||||
r($admin->getMenuKeyTest('sms', 'index')) && p() && e('message'); //访问短信页面
|
||||
r($admin->getMenuKeyTest('message', 'browser')) && p() && e('message'); //访问浏览器页面
|
||||
r($admin->getMenuKeyTest('message', 'setting')) && p() && e('message'); //访问信息配置页面
|
||||
r($admin->getMenuKeyTest('extension', 'browse')) && p() && e('extension'); //访问插件页面
|
||||
r($admin->getMenuKeyTest('dev', 'api')) && p() && e('dev'); //访问API页面
|
||||
r($admin->getMenuKeyTest('dev', 'db')) && p() && e('dev'); //访问数据库页面
|
||||
r($admin->getMenuKeyTest('dev', 'editor')) && p() && e('dev'); //访问编辑器页面
|
||||
r($admin->getMenuKeyTest('entry', 'browse')) && p() && e('dev'); //访问应用页面
|
||||
r($admin->getMenuKeyTest('convert', 'convertjira')) && p() && e('convert'); //访问数据导入页面
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel::getPublicClassByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
查询公开课程数量 >> 2
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$tester->loadModel('admin');
|
||||
$result = $tester->admin->getPublicClassByAPI();
|
||||
|
||||
r(count($result)) && p() && e('2'); // 查询公开课程数量
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getRegisterInfo();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> 易软天创网络科技有限公司
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getRegisterInfoTest()) && p('company') && e('易软天创网络科技有限公司'); //正常测试
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getSecretKey();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getSecretKeyTest()) && p() && e();
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getSignature();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> 1
|
||||
|
||||
*/
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getSignatureTest()) && p() && e('1'); //正常测试
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getStatOfCompany();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getStatOfCompanyTest()) && p() && e();
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getStatOfPMS();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getStatOfPMSTest()) && p() && e('0'); //正常测试
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getStatOfSys();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getStatOfSysTest()) && p() && e();
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->postAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
a($admin->postAPITest());die;
|
||||
r($admin->postAPITest()) && p() && e();
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->registerByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->registerByAPITest()) && p() && e();
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->sendCodeByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->sendCodeByAPITest()) && p() && e();
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->setCompanyByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->setCompanyByAPITest()) && p() && e();
|
||||
@@ -0,0 +1,300 @@
|
||||
<?php
|
||||
class apiTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('api');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test publish a lib.
|
||||
*
|
||||
* @param object $data
|
||||
* @param bool $confirm
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function publishLibTest($data, $confirm = true)
|
||||
{
|
||||
$objectID = $this->objectModel->publishLib($data);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getRelease($data->lib);
|
||||
|
||||
if($confirm) $this->objectModel->deleteRelease($objectID);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete a release.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function deleteReleaseTest($id, $libID = 0)
|
||||
{
|
||||
$this->objectModel->deleteRelease($id);
|
||||
|
||||
$objects = $this->objectModel->getRelease($libID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a api.
|
||||
*
|
||||
* @param array $params
|
||||
* @param bool $confirm
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createTest($params, $confirm = true)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$_POST = $params;
|
||||
$objects = $this->objectModel->create($params['lib']);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($confirm) $tester->dao->delete()->from(TABLE_API)->where('id')->eq($objects->id)->exec();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a data struct.
|
||||
*
|
||||
* @param object $data
|
||||
* @param bool $confirm
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createStructTest($data, $confirm = true)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$objectID = $this->objectModel->createStruct($data);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getStructByID($objectID);
|
||||
|
||||
if($confirm) $tester->dao->delete()->from(TABLE_APISTRUCT)->where('id')->eq($objects->id)->exec();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update a data struct.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $params
|
||||
* @param bool $confirm
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function updateStructTest($id, $params, $confirm = true)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$_POST = $params;
|
||||
$objects = $this->objectModel->updateStruct($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($confirm) $tester->dao->delete()->from(TABLE_APISTRUCT)->where('id')->eq($id)->exec();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update a api.
|
||||
*
|
||||
* @param int $apiID
|
||||
* @param array $params
|
||||
* @param bool $confirm
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function updateTest($apiID, $params, $confirm = true)
|
||||
{
|
||||
global $tester;
|
||||
$_POST = $params;
|
||||
|
||||
$objects = $this->objectModel->update($apiID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($confirm) $tester->dao->delete()->from(TABLE_API)->where('id')->eq($apiID)->exec();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get data struct list by libID.
|
||||
*
|
||||
* @param int $id
|
||||
* @param bool $confirm
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getStructListByLibIDTest($id, $confirm = true)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$objects = $this->objectModel->getStructListByLibID($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($confirm) $tester->dao->delete()->from(TABLE_APISTRUCT)->where('id')->eq($objects['0']->id)->exec();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get a data struct by ID.
|
||||
*
|
||||
* @param int $id
|
||||
* @param bool $confirm
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getStructByIDTest($id, $confirm = true)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$objects = $this->objectModel->getStructByID($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($confirm) $tester->dao->delete()->from(TABLE_APISTRUCT)->where('id')->eq($objects->id)->exec();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get release by libID.
|
||||
*
|
||||
* @param int $libID
|
||||
* @param string $type
|
||||
* @param int $params
|
||||
* @param bool $confirm
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getReleaseTest($libID = 0, $type = '', $param = 0, $confirm = true)
|
||||
{
|
||||
$objects = $this->objectModel->getRelease($libID = 0, $type = '', $param = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($confirm) $this->objectModel->deleteRelease($objects->id);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get release list by api.
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $id
|
||||
* @param bool $confirm
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getReleaseListByApiTest($libID, $id = 0, $confirm = true)
|
||||
{
|
||||
$objects = $this->objectModel->getReleaseListByApi($libID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($confirm) $this->objectModel->deleteRelease($objects[$id]->id);
|
||||
|
||||
return $objects[$id];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get lib by ID.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $version
|
||||
* @param int $release
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getLibByIdTest($id, $version = 0, $release = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getLibById($id, $version = 0, $release = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get lib by ID.
|
||||
*
|
||||
* @param int $id
|
||||
* @param int $version
|
||||
* @param int $release
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getApiListByReleaseTest($release, $where = '1 = 1 ')
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$objects = $this->objectModel->getApiListByRelease($release, $where = '1 = 1 ');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
foreach($release->snap['apis'] as $api) $tester->dao->delete()->from(TABLE_API)->where('id')->eq($api['id'])->exec();
|
||||
$this->objectModel->deleteRelease($release->id);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get list by module ID.
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $moduleID
|
||||
* @param int $release
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getListByModuleIdTest($libID = 0, $moduleID = 0, $release = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getListByModuleId($libID, $moduleID, $release);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return current($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get struct list by release.
|
||||
*
|
||||
* @param object $release
|
||||
* @param string $where
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getStructListByReleaseTest($release, $where = '1 = 1 ', $orderBy = 'id')
|
||||
{
|
||||
$objects = $this->objectModel->getStructListByRelease($release, $where = '1 = 1 ', $orderBy = 'id');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->create();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试创建api >> 920
|
||||
测试没有lib创建api >> 『所属接口库』不能为空。
|
||||
测试没有title创建api >> 『接口名称』不能为空。
|
||||
测试没有path创建api >> 『请求路径』不能为空。
|
||||
|
||||
*/
|
||||
|
||||
$api = new apiTest();
|
||||
|
||||
$data = array(
|
||||
'lib' => 920,
|
||||
'module' => 0,
|
||||
'title' => 'testapi',
|
||||
'protocol' => 'HTTP',
|
||||
'method' => 'GET',
|
||||
'path' => '/api/test/id/test',
|
||||
'requestType' => 'application/json',
|
||||
'status' => 'done',
|
||||
'owner' => 'admin',
|
||||
'type' => 'formData',
|
||||
'params' => '{"header":[],"params":[],"paramsType":"","query":[]}',
|
||||
'desc' => '',
|
||||
'paramsExample' => '',
|
||||
'response' => '[]',
|
||||
'responseExample' => ''
|
||||
);
|
||||
|
||||
$normalApi = $data;
|
||||
|
||||
$emptyLibApi = $data;
|
||||
$emptyLibApi['lib'] = 0;
|
||||
|
||||
$emptyTitleApi = $data;
|
||||
$emptyTitleApi['title'] = '';
|
||||
|
||||
$emptyPathApi = $data;
|
||||
$emptyPathApi['path'] = '';
|
||||
|
||||
r($api->createTest($normalApi)) && p('lib') && e('920'); //测试创建api
|
||||
r($api->createTest($emptyLibApi)) && p('lib:0') && e('『所属接口库』不能为空。'); //测试没有lib创建api
|
||||
r($api->createTest($emptyTitleApi)) && p('title:0') && e('『接口名称』不能为空。'); //测试没有title创建api
|
||||
r($api->createTest($emptyPathApi)) && p('path:0') && e('『请求路径』不能为空。'); //测试没有path创建api
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->createStruct();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
创建数据结构 >> struct
|
||||
创建没有结构名的数据结构 >> 『结构名』不能为空。
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$api = new apiTest();
|
||||
|
||||
$emptyNameStruct = new stdclass();
|
||||
$emptyNameStruct->name = '';
|
||||
$emptyNameStruct->type = 'formData';
|
||||
$emptyNameStruct->attribute = '[{"field":"field1","paramsType":"string","required":true,"desc":"desc","structType":"formData","sub":1,"key":"l2u5qy3jc1se6ghigll","children":[]}]';
|
||||
$emptyNameStruct->desc = '';
|
||||
$emptyNameStruct->addedBy = $tester->app->user->account;
|
||||
$emptyNameStruct->addedDate = helper::now();
|
||||
|
||||
$normalStruct = new stdclass();
|
||||
$normalStruct->name = 'struct';
|
||||
$normalStruct->type = 'formData';
|
||||
$normalStruct->attribute = '[{"field":"field1","paramsType":"string","required":true,"desc":"desc","structType":"formData","sub":1,"key":"l2u5qy3jc1se6ghigll","children":[]}]';
|
||||
$normalStruct->desc = '';
|
||||
$normalStruct->addedBy = $tester->app->user->account;
|
||||
$normalStruct->addedDate = helper::now();
|
||||
|
||||
r($api->createStructTest($normalStruct)) && p('name') && e('struct'); //创建数据结构
|
||||
r($api->createStructTest($emptyNameStruct)) && p('name:0') && e('『结构名』不能为空。'); //创建没有结构名的数据结构
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->deleteRelease();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
删除一个发布 >> 1
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
r($api->deleteReleaseTest(1, 1)) && p('id') && e('1'); //删除一个发布
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->getApiListByRelease();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
创建api后创建发布,使用发布查找api >> 910
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$api = new apiTest();
|
||||
|
||||
$data = array(
|
||||
'lib' => 910,
|
||||
'module' => 0,
|
||||
'title' => 'testapi',
|
||||
'protocol' => 'HTTP',
|
||||
'method' => 'GET',
|
||||
'path' => '/api/test/id',
|
||||
'requestType' => 'application/json',
|
||||
'status' => 'done',
|
||||
'owner' => 'admin',
|
||||
'type' => 'formData',
|
||||
'params' => '{"header":[],"params":[],"paramsType":"","query":[]}',
|
||||
'desc' => '',
|
||||
'paramsExample' => '',
|
||||
'response' => '[]',
|
||||
'responseExample' => ''
|
||||
);
|
||||
$normalApi = $data;
|
||||
|
||||
$normalRelease = new stdclass();
|
||||
$normalRelease->version = 'Version1';
|
||||
$normalRelease->desc = '';
|
||||
$normalRelease->lib = 910;
|
||||
$normalRelease->addedBy = $tester->app->user->account;
|
||||
$normalRelease->addedDate = helper::now();
|
||||
|
||||
$apiInfo = $api->createTest($normalApi, false);
|
||||
$release = $api->publishLibTest($normalRelease, false);
|
||||
|
||||
r($api->getApiListByReleaseTest($release)) && p('0:lib') && e('910'); //创建api后创建发布,使用发布查找api
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->getLibById();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取刚创建的api >> 910
|
||||
|
||||
*/
|
||||
|
||||
$api = new apiTest();
|
||||
|
||||
$data = array(
|
||||
'lib' => 910,
|
||||
'module' => 0,
|
||||
'title' => '测试api',
|
||||
'protocol' => 'HTTP',
|
||||
'method' => 'GET',
|
||||
'path' => '/api/test/id',
|
||||
'requestType' => 'application/json',
|
||||
'status' => 'done',
|
||||
'owner' => 'admin',
|
||||
'type' => 'formData',
|
||||
'params' => '{"header":[],"params":[],"paramsType":"","query":[]}',
|
||||
'desc' => '',
|
||||
'paramsExample' => '',
|
||||
'response' => '[]',
|
||||
'responseExample' => ''
|
||||
);
|
||||
|
||||
$normalApi = $data;
|
||||
|
||||
$apiInfo = $api->createTest($normalApi, false);
|
||||
r($api->getLibByIdTest($apiInfo->id)) && p('lib') && e('910'); //获取刚创建的api
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->getListByModuleId();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
通过正常的libID、moduleID、releaseID查询api信息 >> 获取反馈列表
|
||||
通过正常的libID、moduleID,不传releaseID,查询api信息 >> 0
|
||||
通过正常的libID,不传moduleID、releaseID查询api信息 >> 0
|
||||
通过不存在的libID,moduleID,releaseID查询api信息 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$api = new apiTest();
|
||||
|
||||
r($api->getListByModuleIdTest(1950, 6392, 1)) && p('title') && e('获取反馈列表'); //通过正常的libID、moduleID、releaseID查询api信息
|
||||
r($api->getListByModuleIdTest(1950, 6396, 0)) && p('title') && e('0'); //通过正常的libID、moduleID,不传releaseID,查询api信息
|
||||
r($api->getListByModuleIdTest(1, 0, 0)) && p('title') && e('0'); //通过正常的libID,不传moduleID、releaseID查询api信息
|
||||
r($api->getListByModuleIdTest(0, 0, 0)) && p('title') && e('0'); //通过不存在的libID,moduleID,releaseID查询api信息
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->getRelease();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取刚创建的发布 >> Version1
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$api = new apiTest();
|
||||
|
||||
$normalRelease = new stdclass();
|
||||
$normalRelease->version = 'Version1';
|
||||
$normalRelease->desc = '';
|
||||
$normalRelease->lib = 910;
|
||||
$normalRelease->addedBy = $tester->app->user->account;
|
||||
$normalRelease->addedDate = helper::now();
|
||||
|
||||
$release = $api->publishLibTest($normalRelease, false);
|
||||
r($api->getReleaseTest($release->lib)) && p('version') && e('Version1'); //获取刚创建的发布
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->getReleaseListByApi();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取刚插入的发布信息 >> 910
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$api = new apiTest();
|
||||
|
||||
$normalRelease = new stdclass();
|
||||
$normalRelease->version = 'Version1';
|
||||
$normalRelease->desc = '';
|
||||
$normalRelease->lib = 910;
|
||||
$normalRelease->addedBy = $tester->app->user->account;
|
||||
$normalRelease->addedDate = helper::now();
|
||||
|
||||
$release = $api->publishLibTest($normalRelease, false);
|
||||
r($api->getReleaseListByApiTest($release->lib, $release->id)) && p("lib") && e('910'); //获取刚插入的发布信息
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->getStructByID();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取刚创建的数据结构 >> struct
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$api = new apiTest();
|
||||
|
||||
$normalStruct = new stdclass();
|
||||
$normalStruct->name = 'struct';
|
||||
$normalStruct->type = 'formData';
|
||||
$normalStruct->attribute = '[{"field":"field1","paramsType":"string","required":true,"desc":"desc","structType":"formData","sub":1,"key":"l2u5qy3jc1se6ghigll","children":[]}]';
|
||||
$normalStruct->desc = '';
|
||||
$normalStruct->addedBy = $tester->app->user->account;
|
||||
$normalStruct->addedDate = helper::now();
|
||||
|
||||
$struct = $api->createStructTest($normalStruct, false);
|
||||
r($api->getStructByIDTest($struct->id)) && p('name') && e('struct'); //获取刚创建的数据结构
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->getStructListByLibID();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
用libID获取刚插入的数据结构 >> 910
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$api = new apiTest();
|
||||
|
||||
$normalStruct = new stdclass();
|
||||
$normalStruct->name = 'struct';
|
||||
$normalStruct->lib = 910;
|
||||
$normalStruct->type = 'formData';
|
||||
$normalStruct->attribute = '[{"field":"field1","paramsType":"string","required":true,"desc":"desc","structType":"formData","sub":1,"key":"l2u5qy3jc1se6ghigll","children":[]}]';
|
||||
$normalStruct->desc = '';
|
||||
$normalStruct->addedBy = $tester->app->user->account;
|
||||
$normalStruct->addedDate = helper::now();
|
||||
|
||||
$struct = $api->createStructTest($normalStruct, false);
|
||||
|
||||
r($api->getStructListByLibIDTest($normalStruct->lib)) && p('0:lib') && e('910'); //用libID获取刚插入的数据结构
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->getStructListByRelease();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取没有接口库的接口文档的名称 >> editStruct
|
||||
获取所属接口库ID为1的接口文档的名称 >> user
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$api = new apiTest();
|
||||
|
||||
r($api->getStructListByReleaseTest('', 'where lib = 0')) && p('2:name') && e('editStruct'); // 获取没有接口库的接口文档的名称
|
||||
r($api->getStructListByReleaseTest('', 'where lib = 1')) && p('0:name') && e('user'); // 获取所属接口库ID为1的接口文档的名称
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->publishLib();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
没有版本名的发布 >> 『版本』不能为空。
|
||||
正常的发布 >> Version1
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$api = new apiTest();
|
||||
|
||||
$emptyBuildRelease = new stdclass();
|
||||
$emptyBuildRelease->version = '';
|
||||
$emptyBuildRelease->desc = '';
|
||||
$emptyBuildRelease->lib = 910;
|
||||
$emptyBuildRelease->addedBy = $tester->app->user->account;
|
||||
$emptyBuildRelease->addedDate = helper::now();
|
||||
|
||||
$normalRelease = new stdclass();
|
||||
$normalRelease->version = 'Version1';
|
||||
$normalRelease->desc = '';
|
||||
$normalRelease->lib = 910;
|
||||
$normalRelease->addedBy = $tester->app->user->account;
|
||||
$normalRelease->addedDate = helper::now();
|
||||
|
||||
r($api->publishLibTest($emptyBuildRelease)) && p('version:0') && e('『版本』不能为空。'); //没有版本名的发布
|
||||
r($api->publishLibTest($normalRelease)) && p('version') && e('Version1'); //正常的发布
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->update();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
修改一个刚创建的api >> edittestapi
|
||||
|
||||
*/
|
||||
|
||||
$api = new apiTest();
|
||||
|
||||
$data = array(
|
||||
'lib' => 910,
|
||||
'module' => 0,
|
||||
'title' => 'testapi',
|
||||
'protocol' => 'HTTP',
|
||||
'method' => 'GET',
|
||||
'path' => '/api/test/test',
|
||||
'requestType' => 'application/json',
|
||||
'status' => 'done',
|
||||
'owner' => 'admin',
|
||||
'type' => 'formData',
|
||||
'params' => '{"header":[],"params":[],"paramsType":"","query":[]}',
|
||||
'desc' => '',
|
||||
'paramsExample' => '',
|
||||
'response' => '[]',
|
||||
'responseExample' => ''
|
||||
);
|
||||
|
||||
$editData = array(
|
||||
'lib' => 910,
|
||||
'module' => 0,
|
||||
'title' => 'edittestapi',
|
||||
'protocol' => 'HTTP',
|
||||
'method' => 'GET',
|
||||
'path' => '/api/test/id',
|
||||
'requestType' => 'application/json',
|
||||
'status' => 'done',
|
||||
'owner' => 'admin',
|
||||
'type' => 'formData',
|
||||
'params' => '{"header":[],"params":[],"paramsType":"","query":[]}',
|
||||
'desc' => '',
|
||||
'paramsExample' => '',
|
||||
'response' => '[]',
|
||||
'responseExample' => ''
|
||||
);
|
||||
|
||||
$normalApi = $data;
|
||||
$editApi = $editData;
|
||||
|
||||
$apiInfo = $api->createTest($normalApi, false);
|
||||
|
||||
r($api->updateTest($apiInfo->id, $editApi)) && p('0:new') && e('edittestapi'); //修改一个刚创建的api
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/api.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 apiModel->updateStruct();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常的修改 >> editStruct
|
||||
没有名称的修改 >> 『结构名』不能为空。
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$api = new apiTest();
|
||||
|
||||
$normalStruct = new stdclass();
|
||||
$normalStruct->name = 'struct';
|
||||
$normalStruct->type = 'formData';
|
||||
$normalStruct->attribute = '[{"field":"field1","paramsType":"string","required":true,"desc":"desc","structType":"formData","sub":1,"key":"l2u5qy3jc1se6ghigll","children":[]}]';
|
||||
$normalStruct->desc = '';
|
||||
$normalStruct->addedBy = $tester->app->user->account;
|
||||
$normalStruct->addedDate = helper::now();
|
||||
|
||||
$data = array(
|
||||
'name' => 'editStruct',
|
||||
'type' => 'formData',
|
||||
'attribute' => '[{"field":"field1","paramsType":"string","required":true,"desc":"desc","structType":"formData","sub":1,"key":"l2u5qy3jc1se6ghigll","children":[]}]',
|
||||
'desc' => '',
|
||||
);
|
||||
|
||||
$normalEditStruct = $data;
|
||||
|
||||
$emptyNameEditStruct = $data;
|
||||
$emptyNameEditStruct['name'] = '';
|
||||
|
||||
$struct = $api->createStructTest($normalStruct, false);
|
||||
r($api->updateStructTest($struct->id, $normalEditStruct, false)) && p('0:new') && e('editStruct'); //正常的修改
|
||||
r($api->updateStructTest($struct->id, $emptyNameEditStruct)) && p('name:0') && e('『结构名』不能为空。'); //没有名称的修改
|
||||
@@ -0,0 +1,759 @@
|
||||
<?php
|
||||
class blockTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('block');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test save params.
|
||||
*
|
||||
* @param object $block
|
||||
* @param int $id
|
||||
* @param string $source
|
||||
* @param string $type
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function saveTest($block, $id, $source, $type, $module = 'my')
|
||||
{
|
||||
foreach($block as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->save($id, $source, $type, $module);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) a(dao::getError());
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByID($id);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block by ID.
|
||||
*
|
||||
* @param int $blockID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getByIDTest($blockID)
|
||||
{
|
||||
$objects = $this->objectModel->getByID($blockID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get saved block config.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getBlockTest($id)
|
||||
{
|
||||
$objects = $this->objectModel->getBlock($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last key.
|
||||
*
|
||||
* @param string $appName
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getLastKeyTest($module = 'my')
|
||||
{
|
||||
$objects = $this->objectModel->getLastKey($module);
|
||||
|
||||
$objects[$module] = $objects;
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block list for account.
|
||||
*
|
||||
* @param string $appName
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getBlockListTest($module = 'my', $type = '')
|
||||
{
|
||||
$objects = $this->objectModel->getBlockList($module, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hidden blocks
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getHiddenBlocksTest($module = 'my')
|
||||
{
|
||||
$objects = $this->objectModel->getHiddenBlocks($module);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if(empty($objects))
|
||||
{
|
||||
$objects['code'] = 'fail';
|
||||
$objects['message'] = '未获取到隐藏的区块';
|
||||
}
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get data of welcome block.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getWelcomeBlockDataTest()
|
||||
{
|
||||
$objects = $this->objectModel->getWelcomeBlockData();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return json_encode($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init block when account use first.
|
||||
*
|
||||
* @param string $module project|product|execution|qa|my
|
||||
* @param string $type scrum|waterfall|kanban
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function initBlockTest($module, $type = '')
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel->initBlock($module, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = new stdclass();
|
||||
$account = $tester->app->user->account;
|
||||
$section = $module == 'project' ? $type . 'common' : 'common';
|
||||
|
||||
$object->blockInited = $tester->loadModel('setting')->getItem("owner=$account&module=$module§ion=$section&key=blockInited");
|
||||
$object->blockversion = $tester->loadModel('setting')->getItem("owner=$account&module=$module§ion=block&key=initVersion");
|
||||
|
||||
$blockData = $this->objectModel->getBlockList($module, $type);
|
||||
$object->blockData = empty($module) ? 0 : current($blockData);
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block list.
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $dashboard
|
||||
* @param object $model
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getAvailableBlocksTest($module = '', $dashboard = '', $model = '')
|
||||
{
|
||||
$objects = json_decode($this->objectModel->getAvailableBlocks($module, $dashboard, $model));
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getListParamsTest($module = '')
|
||||
{
|
||||
$objects = json_decode($this->objectModel->getListParams($module));
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get todo param.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTodoParamsTest($module = '')
|
||||
{
|
||||
$objects = $this->objectModel->getTodoParams($module = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return json_encode(json_decode($objects), JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get task params.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTaskParamsTest($module = '')
|
||||
{
|
||||
$objects = $this->objectModel->getTaskParams($module = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return json_encode(json_decode($objects), JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Bug Params.
|
||||
*
|
||||
* @access public
|
||||
* @return json
|
||||
*/
|
||||
public function getBugParamsTest($module = '')
|
||||
{
|
||||
$objects = json_decode($this->objectModel->getBugParams($module));
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get case params.
|
||||
*
|
||||
* @access public
|
||||
* @return json
|
||||
*/
|
||||
public function getCaseParamsTest($module = '')
|
||||
{
|
||||
$objects = json_decode($this->objectModel->getCaseParams($module));
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get testtask params.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTesttaskParamsTest($module = '')
|
||||
{
|
||||
$objects = $this->objectModel->getTesttaskParams($module = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return json_encode(json_decode($objects), JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get story params.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getStoryParamsTest($module = '')
|
||||
{
|
||||
$objects = $this->objectModel->getStoryParams($module);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return json_encode(json_decode($objects), JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plan params.
|
||||
*
|
||||
* @access public
|
||||
* @return json
|
||||
*/
|
||||
public function getPlanParamsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getPlanParams();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getReleaseParamsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getReleaseParams();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = json_decode($objects);
|
||||
|
||||
return $objects->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project params.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectParamsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProjectParams();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project team params.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectTeamParamsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProjectTeamParams();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
|
||||
$objects = json_decode($objects);
|
||||
$return = '';
|
||||
foreach($objects as $type => $params)
|
||||
{
|
||||
$return .= "$type:{";
|
||||
foreach($params as $param => $paramValue)
|
||||
{
|
||||
if(is_object($paramValue))
|
||||
{
|
||||
foreach($paramValue as $key => $value) $return .= "$key=>$value,";
|
||||
}
|
||||
else
|
||||
{
|
||||
$return .= "$param:$paramValue,";
|
||||
}
|
||||
}
|
||||
$return = trim($return, ',');
|
||||
$return .= '};';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Build params.
|
||||
*
|
||||
* @access public
|
||||
* @return json
|
||||
*/
|
||||
public function getBuildParamsTest()
|
||||
{
|
||||
$objects = json_decode($this->objectModel->getBuildParams());
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product params.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProductParamsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProductParams();
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$return = '';
|
||||
$objects = json_decode($objects);
|
||||
foreach($objects as $type => $params)
|
||||
{
|
||||
$return .= "$type:{";
|
||||
foreach($params as $param => $paramValue)
|
||||
{
|
||||
if(is_object($paramValue))
|
||||
{
|
||||
foreach($paramValue as $key => $value) $return .= "$key=>$value,";
|
||||
}
|
||||
else
|
||||
{
|
||||
$return .= "$param:$paramValue,";
|
||||
}
|
||||
}
|
||||
$return = trim($return, ',');
|
||||
$return .= '};';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get statistic params.
|
||||
*
|
||||
* @param string $module product|project|execution|qa
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getStatisticParamsTest($module = 'product')
|
||||
{
|
||||
$objects = $this->objectModel->getStatisticParams($module);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return json_encode(json_decode($objects), JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product statistic params.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProductStatisticParamsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProductStatisticParams();
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$return = '';
|
||||
$objects = json_decode($objects);
|
||||
foreach($objects as $type => $params)
|
||||
{
|
||||
$return .= "$type:{";
|
||||
foreach($params as $param => $paramValue)
|
||||
{
|
||||
if(is_object($paramValue))
|
||||
{
|
||||
foreach($paramValue as $key => $value) $return .= "$key=>$value,";
|
||||
}
|
||||
else
|
||||
{
|
||||
$return .= "$param:$paramValue,";
|
||||
}
|
||||
}
|
||||
$return = trim($return, ',');
|
||||
$return .= '};';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get project statistic params.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectStatisticParamsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProjectStatisticParams();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return json_encode(json_decode($objects), JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get execution statistic params.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionStatisticParamsTest()
|
||||
{
|
||||
$objects = json_decode($this->objectModel->getExecutionStatisticParams());
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get qa statistic params.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getQaStatisticParamsTest()
|
||||
{
|
||||
$object = $this->objectModel->getQaStatisticParams();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return json_decode($object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get waterfall issue param.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getWaterfallIssueParamsTest($module = '')
|
||||
{
|
||||
$objects = $this->objectModel->getWaterfallIssueParams($module = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return json_encode(json_decode($objects), JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get waterfall risk param.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getWaterfallRiskParamsTest($module = '')
|
||||
{
|
||||
$objects = $this->objectModel->getWaterfallRiskParams($module = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return json_encode(json_decode($objects), JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get execution params.
|
||||
*
|
||||
* @access public
|
||||
* @return json
|
||||
*/
|
||||
public function getExecutionParamsTest()
|
||||
{
|
||||
$objects = json_decode($this->objectModel->getExecutionParams());
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get assign to me params.
|
||||
*
|
||||
* @access public
|
||||
* @return json
|
||||
*/
|
||||
public function getAssignToMeParamsTest()
|
||||
{
|
||||
$objects = json_decode($this->objectModel->getAssignToMeParams());
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get closed block pairs.
|
||||
*
|
||||
* @param string $closedBlock
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getClosedBlockPairsTest($closedBlock)
|
||||
{
|
||||
$objects = $this->objectModel->getClosedBlockPairs($closedBlock);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if(empty($objects))
|
||||
{
|
||||
$objects['code'] = 'fail';
|
||||
$objects['message'] = '未获取到关闭的区域';
|
||||
}
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test append count params.
|
||||
*
|
||||
* @param string|object $params
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function appendCountParamsTest($params = '')
|
||||
{
|
||||
$objects = $this->objectModel->appendCountParams($params);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = '';
|
||||
foreach($objects as $key => $param)
|
||||
{
|
||||
if(is_array($param))
|
||||
{
|
||||
$string .= "$key:{";
|
||||
foreach($param as $key => $value) $string .= "$key:$value,";
|
||||
$string = trim($string, ',');
|
||||
$string .= '}';
|
||||
}
|
||||
else
|
||||
{
|
||||
$string .= "$key:$param";
|
||||
}
|
||||
$string .= ';';
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check whether long block.
|
||||
*
|
||||
* @param object $block
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isLongBlockTest($block)
|
||||
{
|
||||
$bool = $this->objectModel->isLongBlock($block);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $bool ? 1 : 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check API for ranzhi.
|
||||
*
|
||||
* @param string $hash
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function checkAPITest($hash)
|
||||
{
|
||||
$objects = $this->objectModel->checkAPI($hash);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get testtask params.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getScrumTestParamsTest()
|
||||
{
|
||||
$objects = json_decode($this->objectModel->getScrumTestParams());
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get scrum project list params.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getScrumListParamsTest($module = '')
|
||||
{
|
||||
$objects = $this->objectModel->getScrumListParams($module = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = json_decode($objects);
|
||||
|
||||
return $objects->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get scrum roadmap list params.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getScrumRoadMapParamsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getScrumRoadMapParams();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get scrum product list params.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getScrumProductParamsTest()
|
||||
{
|
||||
$objects = json_decode($this->objectModel->getScrumProductParams());
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getProjectDynamicParamsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProjectDynamicParams();
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$return = '';
|
||||
$objects = json_decode($objects);
|
||||
foreach($objects as $type => $params)
|
||||
{
|
||||
$return .= "$type:{";
|
||||
foreach($params as $param => $paramValue)
|
||||
{
|
||||
if(is_object($paramValue))
|
||||
{
|
||||
foreach($paramValue as $key => $value) $return .= "$key=>$value,";
|
||||
}
|
||||
else
|
||||
{
|
||||
$return .= "$param:$paramValue,";
|
||||
}
|
||||
}
|
||||
$return = trim($return, ',');
|
||||
$return .= '};';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get the total estimated man hours required.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getStorysEstimateHoursTest($storyID)
|
||||
{
|
||||
$object = $this->objectModel->getStorysEstimateHours($storyID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->appendCountParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试新增count param >> count:{name:数量,default:20,control:input};
|
||||
测试新增count param 和 param test >> test:test;count:{name:数量,default:20,control:input};
|
||||
测试新增count param 和 param par >> par:par;count:{name:数量,default:20,control:input};
|
||||
测试新增count param 和 param append >> append:append;count:{name:数量,default:20,control:input};
|
||||
测试新增count param 和 param 空 >> count:{name:数量,default:20,control:input};
|
||||
|
||||
*/
|
||||
$param1 = new stdclass();
|
||||
$param1->test = 'test';
|
||||
|
||||
$param2 = new stdclass();
|
||||
$param2->par = 'par';
|
||||
|
||||
$param3 = new stdclass();
|
||||
$param3->append = 'append';
|
||||
|
||||
$param4 = new stdclass();
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->appendCountParamsTest()) && p() && e('count:{name:数量,default:20,control:input};'); // 测试新增count param
|
||||
r($block->appendCountParamsTest($param1)) && p() && e('test:test;count:{name:数量,default:20,control:input};'); // 测试新增count param 和 param test
|
||||
r($block->appendCountParamsTest($param2)) && p() && e('par:par;count:{name:数量,default:20,control:input};'); // 测试新增count param 和 param par
|
||||
r($block->appendCountParamsTest($param3)) && p() && e('append:append;count:{name:数量,default:20,control:input};'); // 测试新增count param 和 param append
|
||||
r($block->appendCountParamsTest($param4)) && p() && e('count:{name:数量,default:20,control:input};'); // 测试新增count param 和 param 空
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->checkAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试空哈希值 >> 0
|
||||
测试正确的哈希值 >> 1
|
||||
测试错误的哈希值 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->checkAPITest('')) && p('') && e('0'); // 测试空哈希值
|
||||
r($block->checkAPITest('858640a724c2c981983935eb2bbc4ad8')) && p('') && e('1'); // 测试正确的哈希值
|
||||
r($block->checkAPITest('858640a724c2c98198')) && p('') && e('0'); // 测试错误的哈希值
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getAssignToMeParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取当前登陆用户待办的默认参数 >> 待办数,20,input
|
||||
获取当前登陆用户任务的默认参数 >> 任务数,20,input
|
||||
获取当前登陆用户Bug的默认参数 >> Bug数,20,input
|
||||
获取当前登陆用户需求的默认参数 >> 需求数,20,input
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data = $block->getAssignToMeParamsTest();
|
||||
|
||||
r($data) && p('todoCount:name,default,control') && e('待办数,20,input'); // 获取当前登陆用户待办的默认参数
|
||||
r($data) && p('taskCount:name,default,control') && e('任务数,20,input'); // 获取当前登陆用户任务的默认参数
|
||||
r($data) && p('bugCount:name,default,control') && e('Bug数,20,input'); // 获取当前登陆用户Bug的默认参数
|
||||
r($data) && p('storyCount:name,default,control') && e('需求数,20,input'); // 获取当前登陆用户需求的默认参数
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getAvailableBlocks();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
通过获取项目的可用区块 >> 项目计划,最新动态
|
||||
通过获取测试的可用区块 >> 测试统计,Bug列表,用例列表,版本列表
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data[0] = $block->getAvailableBlocksTest('project', 'project', 'waterfall');
|
||||
$data[1] = $block->getAvailableBlocksTest('qa');
|
||||
|
||||
r($data[0]) && p('waterfallgantt,projectdynamic') && e('项目计划,最新动态'); // 通过获取项目的可用区块
|
||||
r($data[1]) && p('statistic,bug,case,testtask') && e('测试统计,Bug列表,用例列表,版本列表'); // 通过获取测试的可用区块
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getBlock();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取block的所属模块 >> my
|
||||
测试获取block的名称 >> 项目统计
|
||||
测试获取block的来源 >> project
|
||||
测试获取block的区块 >> statistic
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data = $block->getBlockTest(99);
|
||||
|
||||
r($data) && p('module') && e('my'); // 测试获取block的所属模块
|
||||
r($data) && p('title') && e('项目统计'); // 测试获取block的名称
|
||||
r($data) && p('source') && e('project'); // 测试获取block的来源
|
||||
r($data) && p('block') && e('statistic'); // 测试获取block的区块
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getBlockList();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
>> 测试统计;指派给我的Bug;指派给我的用例;待测版本列表
|
||||
>> 项目计划;最新计划
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getBlockListTest('qa')) && p('107:title;108:title;109:title;110:title') && e('测试统计;指派给我的Bug;指派给我的用例;待测版本列表');
|
||||
r($block->getBlockListTest('project', 'waterfall')) && p('105:title;106:title') && e('项目计划;最新计划');
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getBugParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试通过模块获取Bug区块的参数 >> 数量;类型;排序
|
||||
测试通过模块获取Bug区块的参数 >> 数量;类型;排序
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data[0] = $block->getBugParamsTest('qa');
|
||||
$data[1] = $block->getBugParamsTest('my');
|
||||
|
||||
r($data[0]) && p('count:name;type:name;orderBy:name') && e('数量;类型;排序'); //测试通过模块获取Bug区块的参数
|
||||
r($data[1]) && p('count:name;type:name;orderBy:name') && e('数量;类型;排序'); //测试通过模块获取Bug区块的参数
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getBuildParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取版本区块参数 >> 数量,20,input
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data = $block->getBuildParamsTest();
|
||||
|
||||
r($data) && p('count:name,default,control') && e('数量,20,input'); //测试获取版本区块参数
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getByID();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取block的所属模块 >> my
|
||||
测试获取block的名称 >> 项目统计
|
||||
测试获取block的来源 >> project
|
||||
测试获取block的区块 >> statistic
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data = $block->getByIDTest(99);
|
||||
|
||||
r($data) && p('module') && e('my'); // 测试获取block的所属模块
|
||||
r($data) && p('title') && e('项目统计'); // 测试获取block的名称
|
||||
r($data) && p('source') && e('project'); // 测试获取block的来源
|
||||
r($data) && p('block') && e('statistic'); // 测试获取block的区块
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getCaseParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试通过模块获取用例区块的参数 >> 数量;类型;排序
|
||||
测试通过模块获取用例区块的参数 >> 数量;类型;排序
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data[0] = $block->getCaseParamsTest('qa');
|
||||
$data[1] = $block->getCaseParamsTest('my');
|
||||
|
||||
r($data[0]) && p('count:name;type:name;orderBy:name') && e('数量;类型;排序'); //测试通过模块获取用例区块的参数
|
||||
r($data[1]) && p('count:name;type:name;orderBy:name') && e('数量;类型;排序'); //测试通过模块获取用例区块的参数
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getClosedBlockPairs();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取关闭的区块键值对 >> 未获取到关闭的区域
|
||||
|
||||
*/
|
||||
|
||||
global $config;
|
||||
$block = new blockTest();
|
||||
$data = $block->getClosedBlockPairsTest('');
|
||||
|
||||
r($data) && p('massage') && e('未获取到关闭的区域'); //测试获取关闭的区块键值对
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getExecutionParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取执行区块的参数 >> 数量;类型
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data = $block->getExecutionParamsTest();
|
||||
|
||||
r($data) && p('count:name;type:name') && e('数量;类型'); //测试获取执行区块的参数
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getExecutionStatisticParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取执行区块的参数 >> 数量;类型
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data = $block->getExecutionStatisticParamsTest();
|
||||
|
||||
r($data) && p('count:name;type:name') && e('数量;类型'); //测试获取执行区块的参数
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getHiddenBlocks();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取隐藏的区块 >> 未获取到隐藏的区块
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getHiddenBlocksTest('my')) && p('message') && e('未获取到隐藏的区块'); //测试获取隐藏的区块
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getLastKey();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试通过qa模块获取区块的key >> 4
|
||||
测试通过my模块获取区块的key >> 10
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data[0] = $block->getLastKeyTest('qa');
|
||||
$data[1] = $block->getLastKeyTest('my');
|
||||
|
||||
r($data[0]) && p('qa') && e('4'); //测试通过qa模块获取区块的key
|
||||
r($data[1]) && p('my') && e('10'); //测试通过my模块获取区块的key
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getListParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试通过模块获取区块的参数 >> 数量
|
||||
测试通过模块获取区块的参数 >> 数量
|
||||
测试通过模块获取区块的参数 >> 数量;类型;排序
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
$data[0] = $block->getListParamsTest('my');
|
||||
$data[1] = $block->getListParamsTest('qa');
|
||||
$data[2] = $block->getListParamsTest('project');
|
||||
|
||||
r($data[0]) && p('count:name') && e('数量'); //测试通过模块获取区块的参数
|
||||
r($data[1]) && p('count:name') && e('数量'); //测试通过模块获取区块的参数
|
||||
r($data[2]) && p('count:name;type:name;orderBy:name') && e('数量;类型;排序'); //测试通过模块获取区块的参数
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getPlanParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取计划参数 >> {"count":{"name":"\u6570\u91cf","default":20,"control":"input"}}
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getPlanParamsTest()) && p() && e('{"count":{"name":"\u6570\u91cf","default":20,"control":"input"}}'); // 获取计划参数
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getProductParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取产品区块的参数 >> type:{name:类型,noclosed=>未关闭,closed=>已关闭,all=>全部,involved=>我参与,control:select};count:{name:数量,default:20,control:input};
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getProductParamsTest()) && p() && e('type:{name:类型,noclosed=>未关闭,closed=>已关闭,all=>全部,involved=>我参与,control:select};count:{name:数量,default:20,control:input};'); // 获取产品区块的参数
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getProductStatisticParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取产品统计区块的参数 >> count:{name:数量,default:20,control:input};type:{name:类型,noclosed=>未关闭,closed=>已关闭,all=>全部,involved=>我参与,control:select};
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getProductStatisticParamsTest()) && p() && e('count:{name:数量,default:20,control:input};type:{name:类型,noclosed=>未关闭,closed=>已关闭,all=>全部,involved=>我参与,control:select};'); // 获取产品统计区块的参数
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getProjectDynamicParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取项目动态区块参数 >> count:{name:数量,default:20,control:input};
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getProjectDynamicParamsTest()) && p() && e('count:{name:数量,default:20,control:input};'); // 获取项目动态区块参数
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getProjectParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取计划参数 >> {"type":{"name":"\u7c7b\u578b","options":{"all":"\u6240\u6709","undone":"\u672a\u5b8c\u6210","wait":"\u672a\u5f00\u59cb","doing":"\u8fdb\u884c\u4e2d","suspended":"\u5df2\u6302\u8d77","closed":"\u5df2\u5173\u95ed"},"control":"select"},"orderBy":{"name":"\u6392\u5e8f","options":{"id_asc":"ID \u9012\u589e","id_desc":"ID \u9012\u51cf","status_asc":"\u72b6\u6001\u6b63\u5e8f","status_desc":"\u72b6\u6001\u5012\u5e8f"},"control":"select"},"count":{"name":"\u6570\u91cf","default":20,"control":"input"}}
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getProjectParamsTest()) && p() && e('{"type":{"name":"\u7c7b\u578b","options":{"all":"\u6240\u6709","undone":"\u672a\u5b8c\u6210","wait":"\u672a\u5f00\u59cb","doing":"\u8fdb\u884c\u4e2d","suspended":"\u5df2\u6302\u8d77","closed":"\u5df2\u5173\u95ed"},"control":"select"},"orderBy":{"name":"\u6392\u5e8f","options":{"id_asc":"ID \u9012\u589e","id_desc":"ID \u9012\u51cf","status_asc":"\u72b6\u6001\u6b63\u5e8f","status_desc":"\u72b6\u6001\u5012\u5e8f"},"control":"select"},"count":{"name":"\u6570\u91cf","default":20,"control":"input"}}'); //获取计划参数
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getProjectStatisticParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取project静态param >> {"count":{"name":"数量","default":20,"control":"input"},"type":{"name":"类型","options":{"undone":"未完成","doing":"进行中","all":"全部","involved":"我参与的"},"control":"select"}}
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getProjectStatisticParamsTest()) && p() && e('{"count":{"name":"数量","default":20,"control":"input"},"type":{"name":"类型","options":{"undone":"未完成","doing":"进行中","all":"全部","involved":"我参与的"},"control":"select"}}'); // 获取project静态param
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getProjectTeamParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取项目团队 >> type:{name:类型,all=>所有,undone=>未完成,wait=>未开始,doing=>进行中,suspended=>已挂起,closed=>已关闭,control:select};orderBy:{name:排序,id_asc=>ID 递增,id_desc=>ID 递减,status_asc=>状态正序,status_desc=>状态倒序,control:select};count:{name:数量,default:20,control:input};
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getProjectTeamParamsTest()) && p() && e('type:{name:类型,all=>所有,undone=>未完成,wait=>未开始,doing=>进行中,suspended=>已挂起,closed=>已关闭,control:select};orderBy:{name:排序,id_asc=>ID 递增,id_desc=>ID 递减,status_asc=>状态正序,status_desc=>状态倒序,control:select};count:{name:数量,default:20,control:input};'); // 测试获取项目团队
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getQaStatisticParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试name >> 类型
|
||||
测试control >> select
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getQaStatisticParamsTest()) && p('type:name') && e('类型'); //测试name
|
||||
r($block->getQaStatisticParamsTest()) && p('type:control') && e('select');//测试control
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getReleaseParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试name >> 数量,20,input
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getReleaseParamsTest()) && p('name,default,control') && e('数量,20,input'); //测试name
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getScrumListParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试name和select >> 类型,select
|
||||
测试options >> 未完成
|
||||
测试options >> 进行中
|
||||
测试options >> 全部
|
||||
测试options >> 我参与
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getScrumListParamsTest()) && p('name,control') && e('类型,select'); //测试name和select
|
||||
r($block->getScrumListParamsTest()) && p('options:undone') && e('未完成'); //测试options
|
||||
r($block->getScrumListParamsTest()) && p('options:doing') && e('进行中'); //测试options
|
||||
r($block->getScrumListParamsTest()) && p('options:all') && e('全部'); //测试options
|
||||
r($block->getScrumListParamsTest()) && p('options:involved') && e('我参与'); //测试options
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getScrumProductParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取产品区块的参数 >> 数量;20;input
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getScrumProductParamsTest()) && p('count:name;count:default;count:control') && e('数量;20;input'); // 测试获取产品区块的参数
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getScrumRoadMapParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取产品路线图区块的参数 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getScrumRoadMapParamsTest()) && p() && e('0'); // 测试获取产品路线图区块的参数
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getScrumTestParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试获取测试单区块的参数 >> 数量;类型
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
r($block->getScrumTestParamsTest()) && p('count:name;type:name') && e('数量;类型'); // 测试获取测试单区块的参数
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/block.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockModel->getStatisticParams();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取空区块的参数 >> {"count":{"name":"数量","default":20,"control":"input"}}
|
||||
获取产品区块的参数 >> {"count":{"name":"数量","default":20,"control":"input"},"type":{"name":"类型","options":{"noclosed":"未关闭","closed":"已关闭","all":"全部","involved":"我参与"},"control":"select"}}
|
||||
获取项目区块的参数 >> {"count":{"name":"数量","default":20,"control":"input"},"type":{"name":"类型","options":{"undone":"未完成","doing":"进行中","all":"全部","involved":"我参与的"},"control":"select"}}
|
||||
获取执行区块的参数 >> {"count":{"name":"数量","default":20,"control":"input"},"type":{"name":"类型","options":{"undone":"未完成","doing":"进行中","all":"所有","involved":"我参与"},"control":"select"}}
|
||||
获取测试区块的参数 >> {"count":{"name":"数量","default":20,"control":"input"},"type":{"name":"类型","options":{"noclosed":"未关闭","closed":"已关闭","all":"全部","involved":"我参与"},"control":"select"}}
|
||||
|
||||
*/
|
||||
|
||||
$block = new blockTest();
|
||||
|
||||
$data = array();
|
||||
$data[0] = $block->getStatisticParamsTest('');
|
||||
$data[1] = $block->getStatisticParamsTest('product');
|
||||
$data[2] = $block->getStatisticParamsTest('project');
|
||||
$data[3] = $block->getStatisticParamsTest('execution');
|
||||
$data[4] = $block->getStatisticParamsTest('qa');
|
||||
|
||||
r($data[0]) && p() && e('{"count":{"name":"数量","default":20,"control":"input"}}'); // 获取空区块的参数
|
||||
r($data[1]) && p() && e('{"count":{"name":"数量","default":20,"control":"input"},"type":{"name":"类型","options":{"noclosed":"未关闭","closed":"已关闭","all":"全部","involved":"我参与"},"control":"select"}}'); // 获取产品区块的参数
|
||||
r($data[2]) && p() && e('{"count":{"name":"数量","default":20,"control":"input"},"type":{"name":"类型","options":{"undone":"未完成","doing":"进行中","all":"全部","involved":"我参与的"},"control":"select"}}'); // 获取项目区块的参数
|
||||
r($data[3]) && p() && e('{"count":{"name":"数量","default":20,"control":"input"},"type":{"name":"类型","options":{"undone":"未完成","doing":"进行中","all":"所有","involved":"我参与"},"control":"select"}}'); // 获取执行区块的参数
|
||||
r($data[4]) && p() && e('{"count":{"name":"数量","default":20,"control":"input"},"type":{"name":"类型","options":{"noclosed":"未关闭","closed":"已关闭","all":"全部","involved":"我参与"},"control":"select"}}'); // 获取测试区块的参数
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user