* Remove unused codes.
This commit is contained in:
@@ -1,590 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -1,300 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -1,759 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -1,422 +0,0 @@
|
||||
<?php
|
||||
class branchTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('branch');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get name by id.
|
||||
*
|
||||
* @param int $branchID
|
||||
* @param int $productID
|
||||
* @param string $field
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIdTest($branchID, $productID = 0, $field = 'name')
|
||||
{
|
||||
$object = $this->objectModel->getById($branchID, $productID, $field);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get branch list.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $executionID
|
||||
* @param string $browseType
|
||||
* @param bool $withMainBranch
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getListTest($productID, $executionID = 0, $browseType = 'active', $withMainBranch = true)
|
||||
{
|
||||
$objects = $this->objectModel->getList($productID, $executionID, $browseType, 'order', null, $withMainBranch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$ids = '';
|
||||
foreach($objects as $object) $ids .= ',' . $object->id;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get pairs.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $params
|
||||
* @param int $executionID
|
||||
* @param string $mergedBranches
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getPairsTest($productID, $params = '', $executionID = 0, $mergedBranches = '')
|
||||
{
|
||||
$objects = $this->objectModel->getPairs($productID, $params, $executionID, $mergedBranches);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$ids = '';
|
||||
foreach($objects as $id => $object) $ids .= ',' . $id;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get all pairs.
|
||||
*
|
||||
* @param string $params
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getAllPairsTest($params = '')
|
||||
{
|
||||
$objects = $this->objectModel->getAllPairs($params);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a branch.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createTest($productID, $param = array())
|
||||
{
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectID = $this->objectModel->create($productID, $withMerge = false);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError()['name'][0];
|
||||
|
||||
global $tester;
|
||||
$object = $tester->dao->select('*')->from(TABLE_BRANCH)->where('id')->eq($objectID)->fetch();
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update branch.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateTest($param)
|
||||
{
|
||||
$branchID = 1;
|
||||
|
||||
$branch = $this->objectModel->getByID($branchID, 0, '');
|
||||
|
||||
$_POST['name'] = $branch->name;
|
||||
$_POST['status'] = $branch->status;
|
||||
$_POST['desc'] = $branch->desc;
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->update($branchID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch update branch.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function batchUpdateTest($param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$productID = 45;
|
||||
$branches = $tester->dao->select('*')->from(TABLE_BRANCH)->where('product')->eq($productID)->fetchAll('id');
|
||||
|
||||
$_POST['IDList'] = array('0' => 0, '9' => 9, '10' => 10);
|
||||
$_POST['default'] = 0;
|
||||
$_POST['name'] = array('9' => $branches['9']->name, '10' => $branches['10']->name);
|
||||
$_POST['desc'] = array('9' => $branches['9']->desc, '10' => $branches['10']->desc);
|
||||
$_POST['status'] = array('9' => $branches['9']->status, '10' => $branches['10']->status);
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->batchUpdate($productID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects[9][0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test close a branch.
|
||||
*
|
||||
* @param int $branchID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function closeTest($branchID)
|
||||
{
|
||||
$this->objectModel->close($branchID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$object = $tester->dao->select('*')->from(TABLE_BRANCH)->where('id')->eq($branchID)->fetch();
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test activate a branch.
|
||||
*
|
||||
* @param int $branchID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function activateTest($branchID)
|
||||
{
|
||||
$this->objectModel->activate($branchID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$object = $tester->dao->select('*')->from(TABLE_BRANCH)->where('id')->eq($branchID)->fetch();
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test unlink branches for projects when product type is normal.
|
||||
*
|
||||
* @param string $productIDList
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function unlinkBranch4ProjectTest($productIDList)
|
||||
{
|
||||
$this->objectModel->unlinkBranch4Project($productIDList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('product')->in($productIDList)->andWhere('branch')->gt(0)->fetchAll();
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test link branches for projects when product type is not normal.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function linkBranch4ProjectTest($productID)
|
||||
{
|
||||
$this->objectModel->linkBranch4Project($productID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('product')->eq($productID)->andWhere('branch')->gt(0)->fetchAll();
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get branch group by products.
|
||||
*
|
||||
* @param int $products
|
||||
* @param string $params
|
||||
* @param string $appendBranch
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getByProductsTest($products, $params = '', $appendBranch = '')
|
||||
{
|
||||
$objects = $this->objectModel->getByProducts($products, $params, $appendBranch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$ids = '';
|
||||
foreach($objects as $productID => $branches)
|
||||
{
|
||||
$ids .= "$productID:";
|
||||
foreach($branches as $branchID => $branchName) $ids .= ",$branchID";
|
||||
$ids .= ';';
|
||||
}
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get product bype by branch.
|
||||
*
|
||||
* @param int $branchID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProductTypeTest($branchID)
|
||||
{
|
||||
$type = $this->objectModel->getProductType($branchID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test sort branch.
|
||||
*
|
||||
* @param string $branches
|
||||
* @param string $order
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function sortTest($branches, $order = '')
|
||||
{
|
||||
$_POST['orderBy'] = $order;
|
||||
$_POST['branches'] = $branches;
|
||||
|
||||
$this->objectModel->sort();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_BRANCH)->where('id')->in($branches)->orderBy('order asc')->fetchAll('id');
|
||||
return implode(',', array_keys($objects));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check branch data.
|
||||
*
|
||||
* @param int $branchID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function checkBranchDataTest($branchID)
|
||||
{
|
||||
$objects = $this->objectModel->checkBranchData($branchID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects ? 1 : 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check branch data.
|
||||
*
|
||||
* @param int $branchID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function setDefaultTest($productID, $branchID)
|
||||
{
|
||||
$this->objectModel->setDefault($productID, $branchID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getById($branchID, $productID, '');
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get branches of product which linked project.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getPairsByProjectProductTest($projectID, $productID)
|
||||
{
|
||||
$objects = $this->objectModel->getPairsByProjectProduct($projectID, $productID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$names = '';
|
||||
foreach($objects as $id => $name) $names .= "$id:$name;";
|
||||
return $names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test display of branch label.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $moduleID
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function showBranchTest($productID, $moduleID = 0, $executionID = 0)
|
||||
{
|
||||
$show = $this->objectModel->showBranch($productID, $moduleID = 0, $executionID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $show ? 1 : 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test change branch language.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function changeBranchLanguageTest($productID)
|
||||
{
|
||||
global $tester;
|
||||
global $lang;
|
||||
|
||||
$filePath = dirname(dirname(dirname(__FILE__))) . DS . 'module' . DS . 'branch' . DS . 'lang' . DS . 'zh-cn.php';
|
||||
include $filePath;
|
||||
|
||||
$this->objectModel->changeBranchLanguage($productID);
|
||||
|
||||
$createLang = $tester->lang->branch->create;
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $createLang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test merge multiple branches into one branch.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $mergedBranches
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function mergeBranchTest($productID, $mergedBranches, $param)
|
||||
{
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectID = $this->objectModel->mergeBranch($productID, $mergedBranches);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$modules = $tester->dao->select('*')->from(TABLE_MODULE)->where('branch')->eq($objectID)->andWhere('root')->eq($productID)->andWhere('type')->eq('story')->fetchAll();
|
||||
return count($modules);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,431 +0,0 @@
|
||||
<?php
|
||||
class buildTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('build');
|
||||
}
|
||||
|
||||
/**
|
||||
* function getByID by test
|
||||
*
|
||||
* @param string $buildID
|
||||
* @param beel $setImgSize
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIDTest($buildID, $setImgSize = false)
|
||||
{
|
||||
$objects = $this->objectModel->getByID($buildID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getByList test by build
|
||||
*
|
||||
* @param array $idList
|
||||
* @param string $count
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByListTest($idList, $count)
|
||||
{
|
||||
$objects = $this->objectModel->getByList($idList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getProjectBuilds test by build
|
||||
*
|
||||
* @param int $count
|
||||
* @param int $projectID
|
||||
* @param string $type
|
||||
* @param string $param
|
||||
* @param string $orderBy
|
||||
* @param string $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectBuildsTest($count, $projectID, $type = 'all', $param = 0, $orderBy = 't1.date_desc,t1.id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getProjectBuilds($projectID, $type, $param, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getProjectBuildsBySearch test by build
|
||||
*
|
||||
* @param string $count
|
||||
* @param string $projectID
|
||||
* @param string $queryID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectBuildsBySearchTest($count, $projectID, $queryID)
|
||||
{
|
||||
$objects = $this->objectModel->getProjectBuildsBySearch($projectID, $queryID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getExecutionBuilds test by build
|
||||
*
|
||||
* @param int $count
|
||||
* @param int $executionID
|
||||
* @param string $type
|
||||
* @param string $param
|
||||
* @param string $orderBy
|
||||
* @param string $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getExecutionBuildsTest($count, $executionID, $type = '', $param = '', $orderBy = 't1.date_desc,t1.id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionBuilds($executionID, $type, $param, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getExecutionBuildsBySearch test by build
|
||||
*
|
||||
* @param int $count
|
||||
* @param int $executionID
|
||||
* @param int $queryID
|
||||
* @access public
|
||||
* @return arraty
|
||||
*/
|
||||
public function getExecutionBuildsBySearchTest($count, $executionID, $queryID)
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionBuildsBySearch($executionID, $queryID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getBuildPairs test by build
|
||||
*
|
||||
* @param int $count
|
||||
* @param array $products
|
||||
* @param string $branch
|
||||
* @param string $params
|
||||
* @param int $objectID
|
||||
* @param string $objectType
|
||||
* @param string $buildIdList
|
||||
* @param string $replace
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBuildPairsTest($count, $products, $branch = 'all', $params = 'noterminate, nodone', $objectID = 0, $objectType = 'execution', $buildIdList = '', $replace = true)
|
||||
{
|
||||
$objects = $this->objectModel->getBuildPairs($products, $branch, $params, $objectID, $objectType, $buildIdList, $replace);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getLast test by build
|
||||
*
|
||||
* @param string $executionID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLastTest($executionID)
|
||||
{
|
||||
$objects = $this->objectModel->getLast($executionID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function create test by build
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function createTest($executionID, $param = array())
|
||||
{
|
||||
$toData = date('Y-m-d');
|
||||
$labels = array();
|
||||
$files = array();
|
||||
|
||||
$createFields = array('product' => '', 'name' => '', 'builder' => 'admin', 'date' => $toData, 'scmPath' => '', 'filePath' => '',
|
||||
'labels' => $labels, 'files' => $files, 'desc' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectID = $this->objectModel->create($executionID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($objectID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function update test by build
|
||||
*
|
||||
* @param int $buildID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateTest($buildID, $param = array())
|
||||
{
|
||||
$toData = date('Y-m-d');
|
||||
$labels = array();
|
||||
$files = array();
|
||||
|
||||
$createFields = array('name' => '', 'builder' => 'admin', 'date' => $toData, 'scmPath' => '', 'filePath' => '',
|
||||
'labels' => $labels, 'files' => $files, 'desc' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->update($buildID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function updateLinkedBug test by build
|
||||
*
|
||||
* @param int $buildID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateLinkedBugTest($buildID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$build = $this->objectModel->getByID($buildID);
|
||||
$bugs = array();
|
||||
|
||||
$createFields = array('bugs' => $bugs);
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$build->bugs .= ',' . join(',', $_POST['bugs']);
|
||||
|
||||
$this->objectModel->updateLinkedBug($build);
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_BUG)->where('id')->in(join(',', $_POST['bugs']))->fetchAll('id');
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function linkStory test by build
|
||||
*
|
||||
* @param int $buildID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function linkStoryTest($buildID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$stories = array();
|
||||
|
||||
$createFields = array('stories' => $stories);
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->linkStory($buildID);
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_BUILD)->where('id')->in($buildID)->fetchAll('id');
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function unlinkStory test by build
|
||||
*
|
||||
* @param int $buildID
|
||||
* @param array $stories
|
||||
* @param int $storyID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function unlinkStoryTest($buildID, $stories = array(), $storyID = 0)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$createFields = array('stories' => $stories);
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
|
||||
$this->objectModel->linkStory($buildID);
|
||||
$this->objectModel->unlinkStory($buildID, $storyID);
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_BUILD)->where('id')->in($buildID)->fetchAll('id');
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Functtion batchUnlinkStory test by build
|
||||
*
|
||||
* @param int $buildID
|
||||
* @param array $stories
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchUnlinkStoryTest($buildID, $stories = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$createFields = array('stories' => $stories);
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
$this->objectModel->linkStory($buildID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
$newFields = array('unlinkStories' => $stories);
|
||||
foreach($newFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
$this->objectModel->batchUnlinkStory($buildID);
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_BUILD)->where('id')->in($buildID)->fetchAll('id');
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function linkBug test by build
|
||||
*
|
||||
* @param int $buildID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function linkBugTest($buildID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$bugs = array();
|
||||
|
||||
$createFields = array('bugs' => $bugs);
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->linkBug($buildID);
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_BUILD)->where('id')->in($buildID)->fetchAll('id');
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function unlinkBug test by build
|
||||
*
|
||||
* @param int $buildID
|
||||
* @param array $bugs
|
||||
* @param int $bugID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function unlinkBugTest($buildID, $bugs, $bugID)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$createFields = array('bugs' => $bugs);
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
|
||||
$this->objectModel->linkBug($buildID);
|
||||
$this->objectModel->unlinkBug($buildID, $bugID);
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_BUILD)->where('id')->in($buildID)->fetchAll('id');
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function batchUnlinkBugTest($buildID, $bugs)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$createFields = array('bugs' => $bugs);
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
$this->objectModel->linkBug($buildID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
$newFields = array('unlinkBugs' => $bugs);
|
||||
foreach($newFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
$this->objectModel->batchUnlinkBug($buildID);
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_BUILD)->where('id')->in($buildID)->fetchAll('id');
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
<?php
|
||||
class caselibTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('caselib');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save lib state test.
|
||||
*
|
||||
* @param int $libID
|
||||
* @param array $libraries
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function saveLibStateTest($libID = 0, $libraries = array())
|
||||
{
|
||||
$objects = $this->objectModel->saveLibState($libID, $libraries);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by ID test.
|
||||
*
|
||||
* @param mixed $libID
|
||||
* @param mixed $setImgSize
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getByIdTest($libID, $setImgSize = false)
|
||||
{
|
||||
$objects = $this->objectModel->getById($libID, $setImgSize);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update test.
|
||||
*
|
||||
* @param mixed $libID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updateTest($libID)
|
||||
{
|
||||
$objects = $this->objectModel->update($libID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getById($libID);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete test.
|
||||
*
|
||||
* @param mixed $libID
|
||||
* @param string $table
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteTest($libID, $table = '')
|
||||
{
|
||||
$objects = $this->objectModel->delete($libID, $table);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getById($libID);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get libraries test.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getLibrariesTest()
|
||||
{
|
||||
$objects = $this->objectModel->getLibraries();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list test.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param mixed $pager
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getListTest($orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getList($orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create test.
|
||||
*
|
||||
* @param mixed $param
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createTest($param)
|
||||
{
|
||||
foreach($param as $k => $v) $_POST[$k] = $v;
|
||||
$libID = $this->objectModel->create();
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getById($libID);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get libcases test.
|
||||
*
|
||||
* @param mixed $libID
|
||||
* @param mixed $browseType
|
||||
* @param int $queryID
|
||||
* @param int $moduleID
|
||||
* @param string $sort
|
||||
* @param mixed $pager
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getLibCasesTest($libID, $browseType, $queryID = 0, $moduleID = 0, $sort = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getLibCases($libID, $browseType, $queryID, $moduleID, $sort, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create from import test.
|
||||
*
|
||||
* @param mixed $libID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createFromImportTest($libID)
|
||||
{
|
||||
$objects = $this->objectModel->createFromImport($libID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch create case test.
|
||||
*
|
||||
* @param mixed $libID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchCreateCaseTest($libID)
|
||||
{
|
||||
$objects = $this->objectModel->batchCreateCase($libID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
class ciTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('ci');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set menu.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function setMenuTest()
|
||||
{
|
||||
$_SESSION['repoID'] = 1;
|
||||
$this->objectModel->setMenu();
|
||||
|
||||
global $lang;
|
||||
return $lang->devops->menu->code;
|
||||
}
|
||||
|
||||
public function getCompileByID($compileID)
|
||||
{
|
||||
global $tester;
|
||||
return $tester->dao->select('compile.*, job.engine,job.pipeline, pipeline.name as jenkinsName,job.server,pipeline.url,pipeline.account,pipeline.token,pipeline.password')
|
||||
->from(TABLE_COMPILE)->alias('compile')
|
||||
->leftJoin(TABLE_JOB)->alias('job')->on('compile.job=job.id')
|
||||
->leftJoin(TABLE_PIPELINE)->alias('pipeline')->on('job.server=pipeline.id')
|
||||
->where('compile.id')->eq($compileID)
|
||||
->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync compile status.
|
||||
*
|
||||
* @param int $jobID
|
||||
* @access public
|
||||
* @return string|object
|
||||
*/
|
||||
public function syncCompileStatusTest($jobID)
|
||||
{
|
||||
global $tester;
|
||||
$tester->loadModel('job')->exec($jobID);
|
||||
$compileID = $tester->dao->select('id')->from(TABLE_COMPILE)->orderBy('id_desc')->fetch('id');
|
||||
|
||||
$notCompileMR = $tester->dao->select('id,jobID')
|
||||
->from(TABLE_MR)
|
||||
->where('jobID')->gt(0)
|
||||
->andWhere('compileStatus')->eq('created')
|
||||
->fetchPairs();
|
||||
|
||||
$compile = $this->getCompileByID($compileID);
|
||||
|
||||
$this->objectModel->syncCompileStatus($compile, $notCompileMR);
|
||||
$compile = $tester->loadModel('compile')->getByID($compileID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $compile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync gitlab task status.
|
||||
*
|
||||
* @param int $jobID
|
||||
* @access public
|
||||
* @return string|bool
|
||||
*/
|
||||
public function syncGitlabTaskStatusTest($jobID)
|
||||
{
|
||||
global $tester;
|
||||
$tester->loadModel('job')->exec($jobID);
|
||||
$compileID = $tester->dao->select('id')->from(TABLE_COMPILE)->orderBy('id_desc')->fetch('id');
|
||||
$compile = $this->getCompileByID($compileID);
|
||||
|
||||
$this->objectModel->syncGitlabTaskStatus($compile);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update build status.
|
||||
*
|
||||
* @param int $compileID
|
||||
* @param string $status
|
||||
* @access public
|
||||
* @return string|object
|
||||
*/
|
||||
public function updateBuildStatusTest($compileID, $status)
|
||||
{
|
||||
$compile = $this->getCompileByID($compileID);
|
||||
$this->objectModel->updateBuildStatus($compile, $status);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$compile = $tester->loadModel('compile')->getByID($compileID);
|
||||
return $compile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send request.
|
||||
*
|
||||
* @param string $url
|
||||
* @param array $data
|
||||
* @param string $userPWD
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function sendRequestTest($url, $data, $userPWD)
|
||||
{
|
||||
$return = $this->objectModel->sendRequest($url, $data, $userPWD);
|
||||
return $return ? 1 : 0;
|
||||
}
|
||||
}
|
||||
@@ -1,197 +0,0 @@
|
||||
<?php
|
||||
class companyTest
|
||||
{
|
||||
|
||||
/**
|
||||
* __construct loadModel execution
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('company');
|
||||
}
|
||||
|
||||
/**
|
||||
* function update test by execution
|
||||
*
|
||||
* @param string $objectID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateObject($objectID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$object = $tester->dbh->query("SELECT `name`,`phone`,`fax`,`address`,`zipcode`,`website`,`backyard`,`guest`
|
||||
FROM zt_company WHERE id = $objectID")->fetch();
|
||||
|
||||
foreach($object as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->update();
|
||||
|
||||
$change = $tester->dbh->query("select * from zt_company WHERE id = $objectID")->fetch();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $change;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function getList test by company
|
||||
*
|
||||
* @param string $count
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getListTest($count)
|
||||
{
|
||||
$object = $this->objectModel->getList();
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error;
|
||||
}
|
||||
elseif($count == 1)
|
||||
{
|
||||
return count($object);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function getFirst test by company
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getFirstTest()
|
||||
{
|
||||
$object = $this->objectModel->getFirst();
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function getByID test by company
|
||||
*
|
||||
* @param string $companyID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByIDTest($companyID = '')
|
||||
{
|
||||
$object = $this->objectModel->getByID($companyID);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function getUsers test by company
|
||||
*
|
||||
* @param string $count
|
||||
* @param string $browseType
|
||||
* @param string $type
|
||||
* @param string $queryID
|
||||
* @param string $deptID
|
||||
* @param string $sort
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUsersTest($count, $browseType, $type, $queryID, $deptID, $sort = '')
|
||||
{
|
||||
$object = $this->objectModel->getUsers($browseType, $type, $queryID, $deptID, $sort);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error;
|
||||
}
|
||||
elseif($count == 1)
|
||||
{
|
||||
return count($object);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function getOutsideCompanies test by company
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getOutsideCompaniesTest()
|
||||
{
|
||||
$object = $this->objectModel->getOutsideCompanies();
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function getCompanyUserPairs test by company
|
||||
*
|
||||
* @param string $count
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getCompanyUserPairsTest($count)
|
||||
{
|
||||
$object = $this->objectModel->getCompanyUserPairs();
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error;
|
||||
}
|
||||
elseif($count == 1)
|
||||
{
|
||||
return count($object);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
<?php
|
||||
class compileTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('compile');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by id
|
||||
*
|
||||
* @param int $buildID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIDTest($buildID)
|
||||
{
|
||||
$objects = $this->objectModel->getByID($buildID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get build list.
|
||||
*
|
||||
* @param int $jobID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getListTest($jobID, $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getList($jobID, $orderBy = 'id_desc', $pager = null);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list by jobID.
|
||||
*
|
||||
* @param int $jobID
|
||||
* @return array
|
||||
*/
|
||||
public function getListByJobIDTest($jobID)
|
||||
{
|
||||
$objects = $this->objectModel->getListByJobID($jobID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last result.
|
||||
*
|
||||
* @param int $jobID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getLastResultTest($jobID)
|
||||
{
|
||||
$objects = $this->objectModel->getLastResult($jobID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get success jobs by job id list.
|
||||
*
|
||||
* @param array $jobIDList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getSuccessJobsTest($jobIDList)
|
||||
{
|
||||
$objects = $this->objectModel->getSuccessJobs($jobIDList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get build url.
|
||||
*
|
||||
* @param object $jenkins
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getBuildUrlTest($jenkins)
|
||||
{
|
||||
$objects = $this->objectModel->getBuildUrl($jenkins);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save build by job
|
||||
*
|
||||
* @param int $jobID
|
||||
* @param string $data
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createByJobTest($jobID, $data = '', $type = 'tag')
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel->createByJob($jobID, $data = '', $type = 'tag');
|
||||
|
||||
$objects = $tester->dao->select('name')->from(TABLE_COMPILE)->where($type)->eq($data)->fetchAll();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute compile
|
||||
*
|
||||
* @param object $compile
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function execTest($compile)
|
||||
{
|
||||
$objects = $this->objectModel->exec($compile);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,253 +0,0 @@
|
||||
<?php
|
||||
class cronTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('cron');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by id test.
|
||||
*
|
||||
* @param int $cronID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIdTest($cronID)
|
||||
{
|
||||
$objects = $this->objectModel->getById($cronID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get crons test.
|
||||
*
|
||||
* @param string $params
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getCronsTest($params = '')
|
||||
{
|
||||
$objects = $this->objectModel->getCrons($params);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse crons test.
|
||||
*
|
||||
* @param array $crons
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function parseCronTest($crons)
|
||||
{
|
||||
$objects = $this->objectModel->parseCron($crons);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change cron status test.
|
||||
*
|
||||
* @param int $cronID
|
||||
* @param string $status
|
||||
* @param bool $changeTime
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function changeStatusTest($cronID, $status, $changeTime = false)
|
||||
{
|
||||
$objects = $this->objectModel->changeStatus($cronID, $status, $changeTime);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change cron status to running test.
|
||||
*
|
||||
* @param int $cronID
|
||||
* @access public
|
||||
* @return bool|int
|
||||
*/
|
||||
public function changeStatusRunningTest($cronID)
|
||||
{
|
||||
$objects = $this->objectModel->changeStatusRunning($cronID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log cron test.
|
||||
*
|
||||
* @param string $log
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function logCronTest($log)
|
||||
{
|
||||
$objects = $this->objectModel->logCron($log);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last execed time test.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getLastTimeTest()
|
||||
{
|
||||
$objects = $this->objectModel->getLastTime();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runable cron test.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function runableTest()
|
||||
{
|
||||
$objects = $this->objectModel->runable();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check change cron test.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function checkChangeTest()
|
||||
{
|
||||
$objects = $this->objectModel->checkChange();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create cron test.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function createTest($param)
|
||||
{
|
||||
foreach($param as $k => $v) $_POST[$k] = $v;
|
||||
$cronID = $this->objectModel->create();
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getById($cronID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update cron test.
|
||||
*
|
||||
* @param int $cronID
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function updateTest($cronID, $param)
|
||||
{
|
||||
foreach($param as $k => $v) $_POST[$k] = $v;
|
||||
$objects = $this->objectModel->update($cronID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getById($cronID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check cron rule test.
|
||||
*
|
||||
* @param object $cron
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function checkRuleTest($cron)
|
||||
{
|
||||
$objects = $this->objectModel->checkRule($cron);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark cron status test.
|
||||
*
|
||||
* @param mixed $status
|
||||
* @param int $configID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function markCronStatusTest($status, $configID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->markCronStatus($status, $configID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config id test.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getConfigIDTest()
|
||||
{
|
||||
$objects = $this->objectModel->getConfigID();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current cron status test.
|
||||
*
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getTurnonTest()
|
||||
{
|
||||
$objects = $this->objectModel->getTurnon();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,358 +0,0 @@
|
||||
<?php
|
||||
class customTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('custom');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get all custom lang.
|
||||
*
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getAllLangTest()
|
||||
{
|
||||
$objects = $this->objectModel->getAllLang();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
$counts = count($objects);
|
||||
|
||||
return $counts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set value of an item.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $value
|
||||
* @access public
|
||||
* @return object|int
|
||||
*/
|
||||
public function setItemTest($path, $value = '')
|
||||
{
|
||||
$objects = $this->objectModel->setItem($path, $value);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$level = substr_count($path, '.');
|
||||
if($level > 1)
|
||||
{
|
||||
if($level == 2) list($lang, $module, $key) = explode('.', $path);
|
||||
if($level == 3) list($lang, $module, $section, $key) = explode('.', $path);
|
||||
if($level == 4) list($lang, $module, $section, $key, $system) = explode('.', $path);
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_LANG)->where('`lang`')->eq($lang)->andWhere('`module`')->eq($module)->andWhere('`key`')->eq($key)->fetch();
|
||||
}
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get some items
|
||||
*
|
||||
* @param string $paramString
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getItemsTest($paramString)
|
||||
{
|
||||
$objects = $this->objectModel->getItems($paramString);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete items.
|
||||
*
|
||||
* @param string $paramString
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function deleteItemsTest($paramString)
|
||||
{
|
||||
$objects = $this->objectModel->deleteItems($paramString);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test parse the param string for select or delete items.
|
||||
*
|
||||
* @param string $paramString
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function parseItemParamTest($paramString)
|
||||
{
|
||||
$objects = $this->objectModel->parseItemParam($paramString);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a DAO object to select or delete one or more records.
|
||||
*
|
||||
* @param string $paramString
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return array|int
|
||||
*/
|
||||
public function prepareSQLTest($paramString, $method = 'select')
|
||||
{
|
||||
$params = $this->objectModel->parseItemParam($paramString);
|
||||
if($method == 'delete')
|
||||
{
|
||||
$objects = $this->objectModel->prepareSQL($params, $method)->exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
$objects = $this->objectModel->prepareSQL($params, $method)->orderBy('lang,id')->fetchAll('key');
|
||||
}
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function saveCustomMenuTest($menu, $module, $method = '')
|
||||
{
|
||||
$objects = $this->objectModel->saveCustomMenu($menu, $module, $method);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getRequiredFieldsTest($moduleConfig)
|
||||
{
|
||||
$objects = $this->objectModel->getRequiredFields($moduleConfig);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get module fields.
|
||||
*
|
||||
* @param string $moduleName
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getFormFieldsTest($moduleName, $method = '')
|
||||
{
|
||||
global $app;
|
||||
$app->loadLang($moduleName);
|
||||
|
||||
$objects = $this->objectModel->getFormFields($moduleName, $method);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get UR and SR pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getURSRPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getURSRPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get UR pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getURPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getURPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get SR pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getSRPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getSRPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get UR and SR list.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getURSRListTest()
|
||||
{
|
||||
$objects = $this->objectModel->getURSRList();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test save required fields.
|
||||
*
|
||||
* @param string $moduleName
|
||||
* @param string $requiredFields
|
||||
* @param string $fieldsType
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function saveRequiredFieldsTest($moduleName, $requiredFields, $fieldsType)
|
||||
{
|
||||
global $app, $tester;
|
||||
$app->loadLang($moduleName);
|
||||
|
||||
$_POST = $requiredFields;
|
||||
$this->objectModel->saveRequiredFields($moduleName);
|
||||
|
||||
$objects = $tester->dao->select('`value`')->from(TABLE_CONFIG)
|
||||
->where('`owner`')->eq('system')
|
||||
->andWhere('`module`')->eq($moduleName)
|
||||
->andWhere('`key`')->eq('requiredFields')
|
||||
->andWhere('`section`')->eq($fieldsType)
|
||||
->fetch();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set product and project and sprint concept.
|
||||
*
|
||||
* @param int $sprintConcept
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setConceptTest($sprintConcept)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$_POST['sprintConcept'] = $sprintConcept;
|
||||
$this->objectModel->setConcept();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
$objects = $tester->dao->select('`id`')->from(TABLE_BLOCK)->where('source')->eq('execution')->fetch();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set UR and SR concept.
|
||||
*
|
||||
* @param array $SRName
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function setURAndSRTest($SRName)
|
||||
{
|
||||
$_POST = $SRName;
|
||||
$objects = $this->objectModel->setURAndSR();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit UR and SR concept.
|
||||
*
|
||||
* @param int $key
|
||||
* @param string $SRName
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function updateURAndSRTest($key = 0, $SRName = '')
|
||||
{
|
||||
global $app, $tester;
|
||||
|
||||
$_POST['URName'] = '用户需求';
|
||||
$_POST['SRName'] = $SRName;
|
||||
$this->objectModel->updateURAndSR($key);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$lang = $app->getClientLang();
|
||||
|
||||
$objects = $tester->dao->select('`value`')->from(TABLE_LANG)
|
||||
->where('`key`')->eq($key)
|
||||
->andWhere('section')->eq('URSRList')
|
||||
->andWhere('lang')->eq($lang)
|
||||
->andWhere('module')->eq('custom')
|
||||
->fetch();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function setStoryRequirementTest()
|
||||
{
|
||||
$objects = $this->objectModel->setStoryRequirement();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for waterfallplus project data..
|
||||
*
|
||||
* @param string $param deleteproject
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function hasWaterfallplusDataTest($param = '')
|
||||
{
|
||||
if($param == 'deleteproject')
|
||||
{
|
||||
global $tester;
|
||||
$tester->dao->update(TABLE_PROJECT)
|
||||
->set('deleted')->eq(1)
|
||||
->where('type')->eq('project')
|
||||
->andWhere('model')->eq('waterfallplus')
|
||||
->exec();
|
||||
}
|
||||
return $this->objectModel->hasWaterfallplusData();
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
class datatableTest
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('datatable');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get field list.
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getFieldListTest($module, $method)
|
||||
{
|
||||
$module = zget($this->objectModel->config->datatable->moduleAlias, "$module-$method", $module);
|
||||
$result = $this->objectModel->getFieldList($module);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get save setting field.
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getSettingTest($module, $method)
|
||||
{
|
||||
$this->objectModel->app->methodName = $method;
|
||||
$result = $this->objectModel->getSetting($module);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test print table head.
|
||||
*
|
||||
* @param array $data
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function printHeadTest($data)
|
||||
{
|
||||
ob_start();
|
||||
$this->objectModel->printHead($data['cols'], $data['orderBy'], $data['vars'], $data['checkBox']);
|
||||
$head = ob_get_clean();
|
||||
|
||||
$isTh = strpos($head, '<th data-flex') !== false ? true : false;
|
||||
$order = $data['orderBy'] ? (strpos($head, "class='sort-") !== false ? true : false) : true;
|
||||
$vars = $data['vars'] ? (strpos($head, $data['vars']) !== false ? true : false) : true;
|
||||
$check = $data['checkBox'] ? (strpos($head, 'checkbox-primary') !== false ? true : false) : true;
|
||||
$result = ($isTh and $order and $vars and $check) ? true : false;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set fixed field width.
|
||||
*
|
||||
* @param object $setting
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setFixedFieldWidthTest($setting)
|
||||
{
|
||||
$result = $this->objectModel->setFixedFieldWidth($setting);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -1,359 +0,0 @@
|
||||
<?php
|
||||
class deptTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('dept');
|
||||
}
|
||||
|
||||
/**
|
||||
* function getByID test by dept
|
||||
*
|
||||
* @param string $deptID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByIDTest($deptID)
|
||||
{
|
||||
$objects = $this->objectModel->getByID($deptID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getDeptPairs test by dept
|
||||
*
|
||||
* @param string $deptID
|
||||
* @param string $count
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDeptPairsTest($deptID, $count)
|
||||
{
|
||||
$objects = $this->objectModel->getDeptPairs($deptID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function buildMenuQuery test by dept
|
||||
*
|
||||
* @param string $rootDeptID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function buildMenuQueryTest($rootDeptID)
|
||||
{
|
||||
$objects = $this->objectModel->buildMenuQuery($rootDeptID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getOptionMenu test by dept
|
||||
*
|
||||
* @param string $rootDeptID
|
||||
* @param string $count
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getOptionMenuTest($rootDeptID, $count)
|
||||
{
|
||||
$objects = $this->objectModel->getOptionMenu($rootDeptID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getTreeMenu test by dept
|
||||
*
|
||||
* @param string $rootDeptID
|
||||
* @param array $userFunc
|
||||
* @param int $param
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTreeMenuTest($rootDeptID, $userFunc, $param = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getTreeMenu($rootDeptID, $userFunc, $param = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function update test by dept
|
||||
*
|
||||
* @param string $deptID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateTest($deptID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$createFields = array('parent' => '', 'name' => '', 'manager' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->update($deptID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_DEPT)->where('id')->eq($deptID)->fetchAll('id');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function createManageLink test by dept
|
||||
*
|
||||
* @param string $deptID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createManageLinkTest($deptID)
|
||||
{
|
||||
$dept = $this->objectModel->getByID($deptID);
|
||||
$objects = $this->objectModel->createManageLink($dept);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function createMemberLink test by dept
|
||||
*
|
||||
* @param string $deptID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createMemberLinkTest($deptID)
|
||||
{
|
||||
$dept = $this->objectModel->getByID($deptID);
|
||||
$objects = $this->objectModel->createMemberLink($dept);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function createGroupManageMemberLink test by dept
|
||||
*
|
||||
* @param string $deptID
|
||||
* @param string $groupID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createGroupManageMemberLinkTest($deptID, $groupID)
|
||||
{
|
||||
$dept = $this->objectModel->getByID($deptID);
|
||||
$objects = $this->objectModel->createGroupManageMemberLink($dept, $groupID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function createManageProjectAdminLink test by dept
|
||||
*
|
||||
* @param string $deptID
|
||||
* @param string $groupID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createManageProjectAdminLinkTest($deptID, $groupID)
|
||||
{
|
||||
$dept = $this->objectModel->getByID($deptID);
|
||||
$objects = $this->objectModel->createManageProjectAdminLink($dept, $groupID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getSons test by dept
|
||||
*
|
||||
* @param string $deptID
|
||||
* @param string $count
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getSonsTest($deptID, $count)
|
||||
{
|
||||
$objects = $this->objectModel->getSons($deptID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getAllChildId test by dept
|
||||
*
|
||||
* @param string $deptID
|
||||
* @param string $count
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getAllChildIdTest($deptID, $count)
|
||||
{
|
||||
$objects = $this->objectModel->getAllChildId($deptID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getParents test by dept
|
||||
*
|
||||
* @param string $deptID
|
||||
* @param string $count
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getParentsTest($deptID, $count)
|
||||
{
|
||||
$objects = $this->objectModel->getParents($deptID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function updateOrder test by dept
|
||||
*
|
||||
* @param array $orders
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateOrderTest($orders)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$objects = $this->objectModel->updateOrder($orders);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_DEPT)->where('id')->eq($orders[0])->fetchAll('id');
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function manageChild test by dept
|
||||
*
|
||||
* @param string $parentDeptID
|
||||
* @param array $childs
|
||||
* @param string $count
|
||||
* @access public
|
||||
* @return arrray
|
||||
*/
|
||||
public function manageChildTest($parentDeptID, $childs, $count)
|
||||
{
|
||||
$objects = $this->objectModel->manageChild($parentDeptID, $childs);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getUsers test by dept
|
||||
*
|
||||
* @param string $browseType
|
||||
* @param string $deptID
|
||||
* @param string $count
|
||||
* @param string $orderBy
|
||||
* @param null $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUsersTest($browseType = 'inside', $deptID = 0, $count = 0, $orderBy = 'id', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getUsers($browseType, $deptID, $pager, $orderBy);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getDeptUserPairs test by dept
|
||||
*
|
||||
* @param int $deptID
|
||||
* @param int $count
|
||||
* @param string $key
|
||||
* @param string $type
|
||||
* @param string $params
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDeptUserPairsTest($deptID = 0, $count = 0, $key = 'account', $type = 'inside', $params = '')
|
||||
{
|
||||
$objects = $this->objectModel->getDeptUserPairs($deptID, $key, $type, $params);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function delete test by dept
|
||||
*
|
||||
* @param int $deptID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function deleteTest($deptID)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$this->objectModel->delete($deptID);
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_DEPT)->fetchAll();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
public function getDataStructureTest($count)
|
||||
{
|
||||
$objects = $this->objectModel->getDataStructure();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($count == '1') return count($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
<?php
|
||||
class designTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('design');
|
||||
}
|
||||
|
||||
/**
|
||||
* Function create test by design
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createTest($projectID, $param = array())
|
||||
{
|
||||
$labels = array();
|
||||
$files = array();
|
||||
|
||||
$createFields = array('product' => '', 'story' => '', 'type' => '', 'name' => '', 'labels' => $labels, 'files' => $files, 'desc' => '');
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectID = $this->objectModel->create($projectID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($objectID);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function batchCreate test by desgin
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchCreateTest($projectID, $productID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$story = array('', '', '', '');
|
||||
$type = array('', '', '', '');
|
||||
$name = array('', '', '', '');
|
||||
$desc = array('', '', '', '');
|
||||
|
||||
$createFields = array('story' => $story, 'type' => $type, 'name' => $name, 'desc' => $desc);
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->batchCreate($projectID, $productID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_DESIGN)->where('project')->eq($projectID)->andwhere('product')->eq($productID)->fetchAll();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function update test by desgin
|
||||
*
|
||||
* @param int $designID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateTest($designID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$labels = array();
|
||||
$files = array();
|
||||
|
||||
$createFields = $tester->dao->select('`product`,`story`,`type`,`name`,`desc`')->from(TABLE_DESIGN)->where('id')->eq($designID)->fetchAll();
|
||||
$createFields[0]->labels = $labels;
|
||||
$createFields[0]->files = $files;
|
||||
foreach($createFields[0] as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->update($designID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function assign test by desgin
|
||||
*
|
||||
* @param int $designID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function assignTest($designID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$createFields = array('assignedTo' => '', 'comment' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->assign($designID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_DESIGN)->where('id')->eq($designID)->fetchAll();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function linkCommitTest($designID, $repoID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$revision = array();
|
||||
|
||||
$createFields = array('revision' => $revision);
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->linkCommit($designID, $repoID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_DESIGN)->where('id')->eq($designID)->fetchAll();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function unlinkCommitTest($designID = 0, $commitID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->unlinkCommit($designID = 0, $commitID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getCommitTest($designID = 0, $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getCommit($designID = 0, $pager = null);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
<?php
|
||||
class devTest
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('dev');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get All tables.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTablesTest()
|
||||
{
|
||||
$result = $this->objectModel->getTables();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get fields of table.
|
||||
*
|
||||
* @param string $table
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getFieldsTest($table)
|
||||
{
|
||||
$result = $this->objectModel->getFields($table);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set field method.
|
||||
*
|
||||
* @param array $type
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function setFieldTest($type)
|
||||
{
|
||||
$this->objectModel->dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
|
||||
$sql = "DESC zt_product";
|
||||
$rawFields = $this->objectModel->dbh->query($sql)->fetchAll();
|
||||
return $this->objectModel->setField((array)$rawFields[1], (object)$rawFields[1], $type, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test get APIs of a module.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getAPIsTest($module)
|
||||
{
|
||||
$result = $this->objectModel->getAPIs($module);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get all modules.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getModulesTest()
|
||||
{
|
||||
$result = $this->objectModel->getModules();
|
||||
foreach($result as $module => $group) $result[$module] = current($group);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get original lang method.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return int|array
|
||||
*/
|
||||
public function getOriginalLangTest($type = 'common', $module = '', $method = '')
|
||||
{
|
||||
$result = $this->objectModel->getOriginalLang($type, $module, $method);
|
||||
return empty($result) ? 0 : $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get customed lang method.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return int|array
|
||||
*/
|
||||
public function getCustomedLangTest($type = 'common', $module = '', $method = '')
|
||||
{
|
||||
$result = $this->objectModel->getCustomedLang($type, $module, $method);
|
||||
return empty($result) ? 0 : $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nav lang.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
* @param string $language
|
||||
* @param object $defaultLang
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getNavLangTest($type, $module, $method, $language = 'zh-cn', $defaultLang = null)
|
||||
{
|
||||
return $this->objectModel->getNavLang($type, $module, $method, $language, $defaultLang);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get links title.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLinkTitleTest()
|
||||
{
|
||||
$lang = $this->objectModel->lang->mainNav;
|
||||
return $this->objectModel->getLinkTitle($lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test parse common lang.
|
||||
*
|
||||
* @param string $lang
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function parseCommonLangTest($lang)
|
||||
{
|
||||
$lang = $this->objectModel->parseCommonLang($lang);
|
||||
return empty($lang) ? 'null' : $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test is original lang changed.
|
||||
*
|
||||
* @param array|string $defaultValue
|
||||
* @param array|string $customedLang
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function isOriginalLangChangedTest($defaultValue, $customedLang)
|
||||
{
|
||||
$isOriginalLangChanged = $this->objectModel->isOriginalLangChanged($defaultValue, $customedLang);
|
||||
return $isOriginalLangChanged ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
/**
|
||||
* Test save customed lang.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
* @param string $language
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function saveCustomedLangTest($type, $module, $method, $language)
|
||||
{
|
||||
$moduleName = $module;
|
||||
if($type == 'common' or $type == 'first') $moduleName = 'common';
|
||||
if($type == 'second') $moduleName = $module . 'Menu';
|
||||
if($type == 'third') $moduleName = $module . 'SubMenu';
|
||||
|
||||
$this->objectModel->config->custom->URSR = $this->objectModel->dao->select('*')->from(TABLE_LANG)->where('section')->eq('URSRList')->andWhere('module')->eq('custom')->andWhere('lang')->eq($language)->orderBy('id')->limit(1)->fetch('key');
|
||||
$this->objectModel->saveCustomedLang($type, $moduleName, $method, $language);
|
||||
$customedLang = $this->objectModel->getCustomedLang($type, $module, $method, $language);
|
||||
return empty($customedLang) ? 'null' : implode('|', $customedLang);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort menus.
|
||||
*
|
||||
* @param object|array $menus
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function sortMenusTest($menus)
|
||||
{
|
||||
$result = '';
|
||||
$menus = $this->objectModel->sortMenus($menus);
|
||||
foreach($menus as $key => $value) $result .= $key . ',';
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -1,596 +0,0 @@
|
||||
<?php
|
||||
class docTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('doc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Function createLib test by doc
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createLibTest($param)
|
||||
{
|
||||
$createFields = array('type' => '', 'name' => '', 'acl' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
$objectID = $this->objectModel->createLib();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getLibById($objectID);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function createApiLib test by doc
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createApiLibTest($param)
|
||||
{
|
||||
global $tester;
|
||||
$tester->loadModel('api');
|
||||
$tester->app->loadLang('doclib');
|
||||
|
||||
$createFields = array('name' => '', 'baseUrl' => '', 'acl' => '', 'desc' => '测试详情');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
$objectID = $this->objectModel->createApiLib();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getLibById($objectID);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function updateApiLib test by doc
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updateApiLibTest($id, $param)
|
||||
{
|
||||
global $tester;
|
||||
$tester->app->loadConfig('api');
|
||||
$tester->app->loadLang('doclib');
|
||||
|
||||
$oldDoc = $this->objectModel->getLibById($id);
|
||||
$data = new stdClass;
|
||||
foreach($param as $key => $value) $data->$key = $value;
|
||||
|
||||
$objects = $this->objectModel->updateApiLib($id, $oldDoc, $data);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function updateLib test by doc
|
||||
*
|
||||
* @param int $libID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateLibTest($libID, $param)
|
||||
{
|
||||
global $tester;
|
||||
$tester->app->loadConfig('doc');
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
$objects = $this->objectModel->updateLib($libID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getDocsByBrowseType test by doc
|
||||
*
|
||||
* @param string $browseType
|
||||
* @param array $moduleID
|
||||
* @param string $sort
|
||||
* @param mixed $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDocsByBrowseTypeTest($browseType, $moduleID, $sort = 'id_desc', $pager = null)
|
||||
{
|
||||
global $tester;
|
||||
$tester->app->loadConfig('doc');
|
||||
|
||||
$objects = $this->objectModel->getDocsByBrowseType($browseType, $queryID = '', $moduleID, $sort, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function create test by doc
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function createTest($param)
|
||||
{
|
||||
global $tester;
|
||||
$tester->loadModel('api');
|
||||
$tester->app->loadLang('doclib');
|
||||
|
||||
$labels = array();
|
||||
$files = array();
|
||||
|
||||
$createFields = array('lib' => '', 'module' => '', 'title' => '', 'keywords' => '', 'type' => '', 'content' => '', 'contentMarkdown' => '', 'contentType' => '',
|
||||
'url' => '', 'labels' => $labels, 'files' => $files, 'contactListMenu' => '', 'acl' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->create();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_DOC)->where('title')->eq($_POST['title'])->andwhere('lib')->eq($_POST['lib'])->fetchAll();
|
||||
unset($_POST);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function update test by doc
|
||||
*
|
||||
* @param int $docID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateTest($docID, $param)
|
||||
{
|
||||
global $tester;
|
||||
$tester->app->loadConfig('api');
|
||||
$tester->app->loadLang('doclib');
|
||||
|
||||
$labels = array();
|
||||
$files = array();
|
||||
|
||||
$createFields = array('lib' => '', 'module' => '', 'title' => '', 'keywords' => '', 'type' => '', 'content' => '', 'contentType' => '',
|
||||
'url' => '', 'labels' => $labels, 'files' => $files, 'contactListMenu' => '', 'acl' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->update($docID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects["changes"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Function saveDraft test by doc
|
||||
*
|
||||
* @param mixed $docID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function saveDraftTest($docID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
$tester->app->loadConfig('doc');
|
||||
$tester->app->loadConfig('allowedTags');
|
||||
$createFields = array('content' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->saveDraft($docID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $tester->dao->select('id,draft')->from(TABLE_DOC)->where('id')->eq($docID)->fetchAll('id');
|
||||
unset($_POST);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getAllLibsByType test by doc
|
||||
*
|
||||
* @param mixed $type
|
||||
* @param mixed $product
|
||||
* @param mixed $pager
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getAllLibsByTypeTest($type, $product, $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getAllLibsByType($type, $pager, $product);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test stat module and document counts of lib.
|
||||
*
|
||||
* @param array $idList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function statLibCountsTest($idList)
|
||||
{
|
||||
$objects = $this->objectModel->statLibCounts($idList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get lib files.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $objectID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getLibFilesTest($type, $objectID, $orderBy, $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getLibFiles($type, $objectID, $orderBy, $pager = null);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$titles = '';
|
||||
foreach($objects as $object)
|
||||
{
|
||||
$titles .= "$object->title,";
|
||||
}
|
||||
$titles = trim($titles, ',');
|
||||
return $titles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get file source pairs.
|
||||
*
|
||||
* @param array $files
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getFileSourcePairsTest($type, $objectID)
|
||||
{
|
||||
$files = $this->objectModel->getLibFiles($type, $objectID, 't1.id_desc', $pager = null);
|
||||
|
||||
$objects = $this->objectModel->getFileSourcePairs($files);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$counts = '';
|
||||
foreach($objects as $type => $items)
|
||||
{
|
||||
$counts .= "$type:" . count($items) .';';
|
||||
}
|
||||
return $counts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get file icon.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $objectID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getFileIconTest($type, $objectID)
|
||||
{
|
||||
$files = $this->objectModel->getLibFiles($type, $objectID, 't1.id_desc', $pager = null);
|
||||
|
||||
$objects = $this->objectModel->getFileIcon($files);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$icons = '';
|
||||
foreach($objects as $object)
|
||||
{
|
||||
preg_match("/icon-[^']*/", $object, $matches);
|
||||
$icons .= "$matches[0] ";
|
||||
}
|
||||
$icons = trim($icons);
|
||||
return $icons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get doc tree.
|
||||
*
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getDocTreeTest($libID)
|
||||
{
|
||||
$objects = $this->objectModel->getDocTree($libID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$names = '';
|
||||
foreach($objects as $object)
|
||||
{
|
||||
$names .= "$object->name:";
|
||||
foreach($object->children as $children) $names .= (isset($children->name) ? $children->name : $children->title) . ",";
|
||||
$names = trim($names, ',');
|
||||
$names .= ";";
|
||||
}
|
||||
return $names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test fill docs in tree.
|
||||
*
|
||||
* @param object $node
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function fillDocsInTreeTest($node, $libID)
|
||||
{
|
||||
$object = $this->objectModel->fillDocsInTree($node, $libID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$docsCounts = "$object->name:$object->docsCount;";
|
||||
foreach($object->children as $children)
|
||||
{
|
||||
if(isset($children->type) and $children->type == 'doc') continue;
|
||||
$docsCounts .= "$children->name:$children->docsCount;";
|
||||
}
|
||||
return $docsCounts;
|
||||
}
|
||||
|
||||
public function getProductCrumbTest($productID, $executionID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getProductCrumb($productID, $executionID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set lib users.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $objectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function setLibUsersTest($type, $objectID)
|
||||
{
|
||||
$objects = $this->objectModel->setLibUsers($type, $objectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return implode($objects, ',');
|
||||
}
|
||||
|
||||
public function getLibIdListByProjectTest($projectID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getLibIdListByProject($projectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get statistic information.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getStatisticInfoTest()
|
||||
{
|
||||
$objects = $this->objectModel->getStatisticInfo();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the previous and next doc.
|
||||
*
|
||||
* @param int $docID
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getPreAndNextDocTest($docID, $libID)
|
||||
{
|
||||
$objects = $this->objectModel->getPreAndNextDoc($docID, $libID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function printChildModuleTest($module, $libID, $methodName, $browseType, $moduleID)
|
||||
{
|
||||
$objects = $this->objectModel->printChildModule($module, $libID, $methodName, $browseType, $moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function buildCrumbTitleTest($libID = 0, $param = 0, $title = '')
|
||||
{
|
||||
$objects = $this->objectModel->buildCrumbTitle($libID = 0, $param = 0, $title = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function buildCreateButton4DocTest($objectType, $objectID, $libID)
|
||||
{
|
||||
$objects = $this->objectModel->buildCreateButton4Doc($objectType, $objectID, $libID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function buildCollectButton4DocTest()
|
||||
{
|
||||
$objects = $this->objectModel->buildCollectButton4Doc();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function buildBrowseSwitchTest($type, $objectID, $viewType)
|
||||
{
|
||||
$objects = $this->objectModel->buildBrowseSwitch($type, $objectID, $viewType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function setFastMenuTest($fastLib)
|
||||
{
|
||||
$objects = $this->objectModel->setFastMenu($fastLib);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get toList and ccList.
|
||||
*
|
||||
* @param int $docID
|
||||
* @access public
|
||||
* @return bool|array
|
||||
*/
|
||||
public function getToAndCcListTest($docID)
|
||||
{
|
||||
$doc = $this->objectModel->getByID($docID);
|
||||
$objects = $this->objectModel->getToAndCcList($doc);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function selectTest($type, $objects, $objectID, $libs, $libID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->select($type, $objects, $objectID, $libs, $libID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getApiModuleTreeTest($rootID, $docID = 0, $release = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getApiModuleTree($rootID, $docID = 0, $release = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getTreeMenuTest($type, $objectID, $rootID, $startModule = 0, $docID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getTreeMenu($type, $objectID, $rootID, $startModule = 0, $docID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function summaryTest($files)
|
||||
{
|
||||
$objects = $this->objectModel->summary($files);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function setMenuByTypeTest($type, $objectID, $libID, $appendLib = 0)
|
||||
{
|
||||
$objects = $this->objectModel->setMenuByType($type, $objectID, $libID, $appendLib = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the url of link type documents needs to be autoloaded.
|
||||
*
|
||||
* @param int $docID
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function checkAutoloadPageTest($docID)
|
||||
{
|
||||
$doc = $this->objectModel->getByID($docID);
|
||||
$objects = $this->objectModel->checkAutoloadPage($doc);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check api library name.
|
||||
*
|
||||
* @param object $lib
|
||||
* @param string $libType
|
||||
* @param int $libID
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function checkApiLibNameTest($lib, $libType, $libID = 0)
|
||||
{
|
||||
$this->objectModel->checkApiLibName($lib, $libType, $libID);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
return zget($errors, 'name', '1');
|
||||
}
|
||||
|
||||
return 'noerror';
|
||||
}
|
||||
}
|
||||
@@ -1,398 +0,0 @@
|
||||
<?php
|
||||
class editorTest
|
||||
{
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('editor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get module files.
|
||||
*
|
||||
* @param string $moduleName
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getModuleFilesTest($moduleName)
|
||||
{
|
||||
$moduleFiles = $this->objectModel->getModuleFiles($moduleName);
|
||||
$modulePath = $this->objectModel->app->getModulePath('', $moduleName);
|
||||
if(!isset($moduleFiles[$modulePath])) return 0;
|
||||
if(!isset($moduleFiles[$modulePath][$modulePath . 'model.php'])) return 0;
|
||||
if(!isset($moduleFiles[$modulePath][$modulePath . 'model.php'][$modulePath . 'model.php/create'])) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get extension files.
|
||||
*
|
||||
* @param string $moduleName
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getExtensionFilesTest($moduleName)
|
||||
{
|
||||
$files = $this->objectModel->getExtensionFiles($moduleName);
|
||||
$edition = $this->objectModel->config->edition;
|
||||
|
||||
if($edition == 'open') return 1;
|
||||
|
||||
$extensionRoot = $this->objectModel->app->getExtensionRoot();
|
||||
$extensionPath = $extensionRoot . $edition . DS . $moduleName . DS . 'ext' . DS . 'control' . DS;
|
||||
if(!isset($files[$edition][$extensionPath])) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get two grade files.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getTwoGradeFilesTest()
|
||||
{
|
||||
$extensionFullDir = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$files = $this->objectModel->getTwoGradeFiles($extensionFullDir);
|
||||
if(!isset($files[$extensionFullDir . 'lang'])) return 0;
|
||||
if(!isset($files[$extensionFullDir . 'lang'][$extensionFullDir . 'lang' . DS . 'zh-cn.php'])) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for analysis.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function analysisTest()
|
||||
{
|
||||
$fileName = $this->objectModel->app->getModulePath('', 'todo') . 'control.php';
|
||||
$objects = $this->objectModel->analysis($fileName);
|
||||
if(!isset($objects[$fileName . '/create'])) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for print tree.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function printTreeTest()
|
||||
{
|
||||
$files = $this->objectModel->getModuleFiles('todo');
|
||||
$tree = $this->objectModel->printTree($files);
|
||||
if(strpos($tree, 'extendTree') === false) return 0;
|
||||
if(strpos($tree, 'L2hvbWUvei9zaXRlcy96ZW50YW9tYXgvbW9kdWxlL3RvZG8vbW9kZWwucGhw') === false) return 0;
|
||||
if(strpos($tree, 'L2hvbWUvei9zaXRlcy96ZW50YW9tYXgvbW9kdWxlL3RvZG8vbW9kZWwucGhwL2JhdGNoQ3JlYXRl') === false) return 0;
|
||||
if(strpos($tree, "target='editWin'") === false) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for add link for dir.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function addLink4DirTest()
|
||||
{
|
||||
$result = '';
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
|
||||
$controlPath = $modulePath . 'control.php';
|
||||
$link = $this->objectModel->addLink4Dir($controlPath);
|
||||
$result .= (strpos($link, 'newPage') === false ? 0 : 1) . ',';
|
||||
|
||||
$modelPath = $modulePath . 'model.php';
|
||||
$link = $this->objectModel->addLink4Dir($modelPath);
|
||||
$result .= (strpos($link, 'newMethod') === false ? 0 : 1) . ',';
|
||||
|
||||
$langPath = $modulePath . 'lang';
|
||||
$link = $this->objectModel->addLink4Dir($langPath);
|
||||
$result .= (strpos($link, 'lang') === false ? 0 : 1) . ',';
|
||||
|
||||
$edition = $this->objectModel->config->edition;
|
||||
if($edition == 'open') return $result . '1,1,1,1,1';
|
||||
|
||||
$extensionRoot = $this->objectModel->app->getExtensionRoot();
|
||||
$extensionPath = $extensionRoot . $edition . DS . 'todo' . DS . 'ext' . DS;
|
||||
$extControlPath = $extensionPath . 'control';
|
||||
$link = $this->objectModel->addLink4Dir($extControlPath);
|
||||
$result .= (strpos($link, 'newExtend') === false ? 0 : 1) . ',';
|
||||
|
||||
$extModelPath = $extensionPath . 'model';
|
||||
$link = $this->objectModel->addLink4Dir($extModelPath);
|
||||
$result .= (strpos($link, 'newExtend') === false ? 0 : 1) . ',';
|
||||
|
||||
$extJSPath = $extensionPath . 'js';
|
||||
$link = $this->objectModel->addLink4Dir($extJSPath);
|
||||
$result .= (strpos($link, 'newJS') === false ? 0 : 1) . ',';
|
||||
|
||||
$extCSSPath = $extensionPath . 'css';
|
||||
$link = $this->objectModel->addLink4Dir($extCSSPath);
|
||||
$result .= (strpos($link, 'newCSS') === false ? 0 : 1) . ',';
|
||||
|
||||
$extLangPath = $extensionPath . 'lang';
|
||||
$link = $this->objectModel->addLink4Dir($extLangPath);
|
||||
$result .= (strpos($link, 'lang') === false ? 0 : 1);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for add link for file.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function addLink4FileTest()
|
||||
{
|
||||
$result = '';
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
|
||||
$viewPath = $modulePath . 'view' . DS . 'create.html.php';
|
||||
$link = $this->objectModel->addLink4File($viewPath, 'create.html.php');
|
||||
$result .= ((strpos($link, 'override') === false || strpos($link, 'newHook') === false) ? 0 : 1) . ',';
|
||||
|
||||
$controlPath = $modulePath . 'control.php' . DS . 'create';
|
||||
$link = $this->objectModel->addLink4File($controlPath, 'create');
|
||||
$result .= (strpos($link, 'extendControl') === false ? 0 : 1) . ',';
|
||||
|
||||
$modelPath = $modulePath . 'model.php' . DS . 'create';
|
||||
$link = $this->objectModel->addLink4File($modelPath, 'create');
|
||||
$result .= (strpos($link, 'extendModel') === false ? 0 : 1) . ',';
|
||||
|
||||
$langPath = $modulePath . 'lang' . DS . 'zh-cn.php';
|
||||
$link = $this->objectModel->addLink4File($langPath, 'zh-cn.php');
|
||||
$result .= ((strpos($link, 'newzh_cn') === false || strpos($link, 'extendOther') === false) ? 0 : 1) . ',';
|
||||
|
||||
$configPath = $modulePath . 'config.php';
|
||||
$link = $this->objectModel->addLink4File($configPath, 'config.php');
|
||||
$result .= ((strpos($link, 'newConfig') === false || strpos($link, 'extendOther') === false) ? 0 : 1) . ',';
|
||||
|
||||
$edition = $this->objectModel->config->edition;
|
||||
if($edition == 'open') return $result . '1,1,1,1,1,1';
|
||||
|
||||
$extensionRoot = $this->objectModel->app->getExtensionRoot();
|
||||
$extensionPath = $extensionRoot . $edition . DS . 'todo' . DS . 'ext' . DS;
|
||||
$extControlPath = $extensionPath . 'control' . DS . 'create.php';
|
||||
$link = $this->objectModel->addLink4File($extControlPath, 'create.php');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1) . ',';
|
||||
|
||||
$extModelPath = $extensionPath . 'model' . DS . 'zentaobiz.class.php';
|
||||
$link = $this->objectModel->addLink4File($extModelPath, 'zentaobiz.class.php');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1) . ',';
|
||||
|
||||
$extJSPath = $extensionPath . 'js' . DS . 'create' . DS . 'zentaobiz.js';
|
||||
$link = $this->objectModel->addLink4File($extJSPath, 'zentaobiz.js');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1) . ',';
|
||||
|
||||
$extCSSPath = $extensionPath . 'css' . DS . 'create' . DS . 'zentaobiz.css';
|
||||
$link = $this->objectModel->addLink4File($extCSSPath, 'zentaobiz.css');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1) . ',';
|
||||
|
||||
$extLangPath = $extensionPath . 'lang' . DS . 'zh-cn' . DS . 'zentaobiz.php';
|
||||
$link = $this->objectModel->addLink4File($extLangPath, 'zentaobiz.php');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1) . ',';
|
||||
|
||||
$extConfigPath = $extensionPath . 'config' . DS . 'zentaobiz.php';
|
||||
$link = $this->objectModel->addLink4File($extConfigPath, 'zentaobiz.php');
|
||||
$result .= ((strpos($link, 'delete') === false || strpos($link, 'edit') === false) ? 0 : 1);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get extend link.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getExtendLinkTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$viewPath = $modulePath . 'view' . DS . 'create.html.php';
|
||||
$link = $this->objectModel->getExtendLink($viewPath, 'extendOther');
|
||||
return (strpos($link, 'edit') !== false && strpos($link, 'extendOther') !== false) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get api link.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getAPILinkTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$modelPath = $modulePath . 'model.php' . DS . 'create';
|
||||
$link = $this->objectModel->getAPILink($modelPath, 'extendModel');
|
||||
return (strpos($link, 'debug') !== false && strpos($link, 'extendModel') !== false) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for extend model.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function extendModelTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$modelPath = $modulePath . 'model.php' . DS . 'create';
|
||||
$content = $this->objectModel->extendModel($modelPath);
|
||||
return strpos($content, 'public function create(') === false ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for extend control.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function extendControlTest()
|
||||
{
|
||||
$result = '';
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$filePath = $modulePath . 'control.php' . DS . 'create';
|
||||
$content = $this->objectModel->extendControl($filePath, 'yes');
|
||||
$result .= strpos($content, 'class mytodo extends todo') !== false ? '1,' : '0,';
|
||||
|
||||
$content = $this->objectModel->extendControl($filePath, 'no');
|
||||
$result .= strpos($content, 'class todo extends control') !== false ? 1 : 0;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for new control.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function newControlTest()
|
||||
{
|
||||
$filePath = $this->objectModel->app->getModulePath('', 'todo') . 'control.php' . DS . 'create';
|
||||
$content = $this->objectModel->newControl($filePath);
|
||||
return (strpos($content, 'class todo extends control') !== false && strpos($content, 'public function create(') !== false) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get param.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getParamTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo') . 'control.php';
|
||||
include $modulePath;
|
||||
$params = $this->objectModel->getParam('todo', 'create');
|
||||
return $params == "\$date='today', \$userID='', \$from='todo'" ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get method code.
|
||||
*
|
||||
* @access public
|
||||
* @return 1|0
|
||||
*/
|
||||
public function getMethodCodeTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo') . 'control.php';
|
||||
include $modulePath;
|
||||
$code = $this->objectModel->getMethodCode('todo', 'create');
|
||||
return strpos($code, "public function create(\$date = 'today', \$userID = '', \$from = 'todo')") !== false ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get save path.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSavePathTest()
|
||||
{
|
||||
$_POST['fileName'] = 'test.php';
|
||||
$result = '';
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$extPath = $this->objectModel->app->getExtensionRoot() . 'custom' . DS;
|
||||
|
||||
$filePath = $modulePath . 'model.php' . DS . 'create';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'extendModel');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'model' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $modulePath . 'control.php' . DS . 'create';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'extendControl');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'control' . DS . 'create.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $modulePath . 'view' . DS . 'create.html.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'override');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'view' . DS . 'create.html.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $modulePath . 'config.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'extendOther');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'config' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $modulePath . 'lang' . DS . 'zh-cn.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'extendOther');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'lang' . DS . 'zh-cn' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$_POST['fileName'] = 'create.html.hook.php';
|
||||
$filePath = $modulePath . 'view' . DS . 'create.html.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newhook');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'view' . DS . 'create.html.hook.php' ? '1,' : '0,';
|
||||
|
||||
$_POST['fileName'] = 'test.php';
|
||||
$filePath = $modulePath . 'control.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newmethod');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'control' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $extPath . 'todo' . DS . 'ext' . DS . 'control';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newextend');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'control' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$filePath = $modulePath . 'config.php';
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newconfig');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'config' . DS . 'test.php' ? '1,' : '0,';
|
||||
|
||||
$_POST['fileName'] = 'test.js';
|
||||
$filePath = $extPath . 'todo' . DS . 'ext' . DS . 'js' . DS . 'create' . DS;
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newJS');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'js' . DS . 'create' . DS . 'test.js' ? '1,' : '0,';
|
||||
|
||||
$_POST['fileName'] = 'test.css';
|
||||
$filePath = $extPath . 'todo' . DS . 'ext' . DS . 'css' . DS . 'create' . DS;
|
||||
$path = $this->objectModel->getSavePath($filePath, 'newCSS');
|
||||
$result .= $path == $extPath . 'todo' . DS . 'ext' . DS . 'css' . DS . 'create' . DS . 'test.css' ? '1' : '0';
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for get class name by path.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getClassNameByPathTest()
|
||||
{
|
||||
$modulePath = $this->objectModel->app->getModulePath('', 'todo');
|
||||
$extPath = $this->objectModel->app->getExtensionRoot() . 'custom' . DS;
|
||||
|
||||
$result = '';
|
||||
$filePath = $modulePath . 'model.php' . DS . 'create';
|
||||
$className = $this->objectModel->getClassNameByPath($filePath);
|
||||
$result .= $className == 'todo' ? '1,' : '0,';
|
||||
$filePath = $extPath . 'todo' . DS . 'ext' . DS . 'control';
|
||||
$className = $this->objectModel->getClassNameByPath($filePath);
|
||||
$result .= $className == 'todo' ? '1' : '0';
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
<?php
|
||||
class entryTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('entry');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get entry by id.
|
||||
*
|
||||
* @param int $entryID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIdTest($entryID)
|
||||
{
|
||||
$object = $this->objectModel->getById($entryID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get entry by code.
|
||||
*
|
||||
* @param int $code
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByCodeTest($code)
|
||||
{
|
||||
$object = $this->objectModel->getByCode($code);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get entry by key.
|
||||
*
|
||||
* @param int $key
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByKeyTest($key)
|
||||
{
|
||||
$object = $this->objectModel->getByKey($key);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list test.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param int $pager
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getListTest($orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getList($orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get logs test.
|
||||
*
|
||||
* @param int $id
|
||||
* @param string $orderBy
|
||||
* @param int $pager
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getLogsTest($id, $orderBy = 'date_desc', $pager = null)
|
||||
{
|
||||
$object = $this->objectModel->getLogs($id, $orderBy, $paper);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a object.
|
||||
*
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createObject($params = array())
|
||||
{
|
||||
$createFields = array();
|
||||
$createFields['name'] = '这是应用名称';
|
||||
$createFields['code'] = 'code';
|
||||
$createFields['account'] = 'admin';
|
||||
$createFields['key'] = md5(time());
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
|
||||
foreach($params as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectID = $this->objectModel->create();
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getById($objectID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update a entry.
|
||||
*
|
||||
* @param int $entryID
|
||||
* @param int $params
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function updateObject($entryID, $params)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$object = $tester->dbh->query("SELECT * FROM " . TABLE_ENTRY ." WHERE id = $entryID")->fetch();
|
||||
|
||||
foreach($object as $field => $value)
|
||||
{
|
||||
if(in_array($field, array_keys($params)))
|
||||
{
|
||||
$_POST[$field] = $params[$field];
|
||||
}
|
||||
else
|
||||
{
|
||||
$_POST[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$change = $this->objectModel->update($entryID);
|
||||
if($change == array()) $change = '没有数据更新';
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $change;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update calledTime.
|
||||
*
|
||||
* @param int $code
|
||||
* @param int $time
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function updateCalledTimeTest($code, $time)
|
||||
{
|
||||
$this->objectModel->updateCalledTime($code, $time);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByCode($code);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test save a log.
|
||||
*
|
||||
* @param int $entryID
|
||||
* @param int $url
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function saveLogTest($entryID, $url)
|
||||
{
|
||||
$this->objectModel->saveLog($entryID, $url);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$object = $tester->dbh->query("SELECT * FROM " . TABLE_LOG ." WHERE objectID = $entryID AND objectType = 'entry'")->fetch();
|
||||
return $object;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,314 +0,0 @@
|
||||
<?php
|
||||
class fileTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('file');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get files of an object.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByObjectTest($objectType, $objectID, $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->getByObject($objectType, $objectID, $extra = '');
|
||||
foreach($objects as $object)
|
||||
{
|
||||
if(isset($object->webPath)) $object->webPath = substr($object->webPath, strpos($object->webPath, '/data/upload'));
|
||||
}
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get info of a file.
|
||||
*
|
||||
* @param int $fileID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIdTest($fileID)
|
||||
{
|
||||
$object = $this->objectModel->getById($fileID);
|
||||
if(isset($object->webPath)) $object->webPath = substr($object->webPath, strpos($object->webPath, '/data/upload'));
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get counts of uploaded files.
|
||||
*
|
||||
* @param array $files
|
||||
* @param array $labels
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getCountTest($files, $labels)
|
||||
{
|
||||
$_FILES['files'] = $files;
|
||||
$_POST['labels'] = $labels;
|
||||
|
||||
$count = $this->objectModel->getCount();
|
||||
|
||||
unset($_FILES['files']);
|
||||
unset($_POST['labels']);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get info of uploaded files.
|
||||
*
|
||||
* @param array $files
|
||||
* @param array $labels
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUploadTest($files, $labels)
|
||||
{
|
||||
$_FILES['files'] = $files;
|
||||
$_POST['labels'] = $labels;
|
||||
|
||||
$objects = $this->objectModel->getUpload($htmlTagName = 'files', $labelsName = 'labels');
|
||||
|
||||
unset($_FILES['files']);
|
||||
unset($_POST['labels']);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get uploaded file from zui.uploader.
|
||||
*
|
||||
* @param array $image
|
||||
* @param array $files
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getUploadFileTest($image, $files)
|
||||
{
|
||||
$_FILES['file'] = $files;
|
||||
|
||||
foreach($image as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$object = $this->objectModel->getUploadFile($htmlTagName = 'file');
|
||||
|
||||
unset($_POST);
|
||||
unset($_FILES['file']);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get extension of a file.
|
||||
*
|
||||
* @param string $filename
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getExtensionTest($filename)
|
||||
{
|
||||
$string = $this->objectModel->getExtension($filename);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get save name.
|
||||
*
|
||||
* @param string $pathName
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSaveNameTest($pathName)
|
||||
{
|
||||
$objects = $this->objectModel->getSaveName($pathName);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get real path name.
|
||||
*
|
||||
* @param string $pathName
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getRealPathNameTest($pathName)
|
||||
{
|
||||
$realpath = $this->objectModel->getRealPathName($pathName);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $realpath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get export tpl.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getExportTemplateTest($module)
|
||||
{
|
||||
$objects = $this->objectModel->getExportTemplate($module);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get tmp import path.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getPathOfImportedFileTest()
|
||||
{
|
||||
$path = $this->objectModel->getPathOfImportedFile();
|
||||
$path = substr($path, strpos($path, 'tmp'));
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test save export template.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function saveExportTemplateTest($module, $file)
|
||||
{
|
||||
foreach($file as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectID = $this->objectModel->saveExportTemplate($module);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError()['title'][0];
|
||||
|
||||
global $tester;
|
||||
$object = $tester->dao->select('*')->from(TABLE_USERTPL)->where('id')->eq($objectID)->fetch();
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set save path.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function setSavePathTest()
|
||||
{
|
||||
$this->objectModel->setSavePath();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$path = substr($tester->file->savePath, strpos($tester->file->savePath, '/www/'));
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set the web path of upload files.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function setWebPathTest()
|
||||
{
|
||||
$this->objectModel->setWebPath();
|
||||
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$path = substr($tester->file->webPath, strpos($tester->file->webPath, '/test/model/'));
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test compress image.
|
||||
*
|
||||
* @param object $file
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function compressImageTest($file)
|
||||
{
|
||||
$object = $this->objectModel->compressImage($file);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update objectID.
|
||||
*
|
||||
* @param int $uid
|
||||
* @param int $objectID
|
||||
* @param string $objectType
|
||||
* @param array $albums
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateObjectIDTest($uid, $objectID, $objectType, $albums)
|
||||
{
|
||||
$_SESSION['album'] = $albums;
|
||||
|
||||
$this->objectModel->updateObjectID($uid, $objectID, $objectType);
|
||||
|
||||
unset($_SESSION['album']);
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_FILE)->where('id')->in($albums['used'][$uid])->fetchAll('id');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get file pairs.
|
||||
*
|
||||
* @param array $IDs
|
||||
* @param string $value
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairsTest($IDs, $value = 'title')
|
||||
{
|
||||
$objects = $this->objectModel->getPairs($IDs, $value);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
<?php
|
||||
class gitTest
|
||||
{
|
||||
public $tester;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->tester = $tester;
|
||||
$this->gitModel = $this->tester->loadModel('git');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update commit.
|
||||
*
|
||||
* @param object $repo
|
||||
* @param array $commentGroup
|
||||
* @param bool $printLog
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function updateCommit($repo)
|
||||
{
|
||||
$repoID = isset($repo->id) ? $repo->id : 0;
|
||||
$oldLastSync = $this->tester->dao->select('lastSync')->from(TABLE_REPO)->where('id')->eq($repoID)->fetch('lastSync');
|
||||
$result = $this->gitModel->updateCommit($repo, array(), false);
|
||||
if(empty($repoID)) return $result;
|
||||
$newLastSync = $this->tester->dao->select('lastSync')->from(TABLE_REPO)->where('id')->eq($repoID)->fetch('lastSync');
|
||||
return $oldLastSync != $newLastSync;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the repos.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setRepos()
|
||||
{
|
||||
$this->gitModel->setRepos();
|
||||
$repo = array_shift($this->gitModel->repos);
|
||||
return $repo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repos.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getRepos()
|
||||
{
|
||||
$pairs = $this->gitModel->getRepos();
|
||||
return array_shift($pairs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set repo.
|
||||
*
|
||||
* @param object $repo
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setRepo($repo)
|
||||
{
|
||||
$this->gitModel->client = '';
|
||||
$this->gitModel->repoRoot = '';
|
||||
|
||||
$result = $this->gitModel->setRepo($repo);
|
||||
|
||||
$data = new stdclass();
|
||||
$data->result = $result;
|
||||
$data->client = !empty($this->gitModel->client);
|
||||
$data->repoRoot = !empty($this->gitModel->repoRoot);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* get tags histories for repo.
|
||||
*
|
||||
* @param object $repo
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getRepoTags($repo)
|
||||
{
|
||||
$tags = $this->gitModel->getRepoTags($repo);
|
||||
if(is_array($tags) and count($tags) >= 1) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repo logs.
|
||||
*
|
||||
* @param object $repo
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getRepoLogs($repo)
|
||||
{
|
||||
$logs = $this->gitModel->getRepoLogs($repo, '');
|
||||
if(is_array($logs) and count($logs) >= 1) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert log from xml format to object.
|
||||
*
|
||||
* @param object $log
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function convertLog($log)
|
||||
{
|
||||
$parsedLogs = $this->gitModel->convertLog($log);
|
||||
if(empty($parsedLogs->revision)) $parsedLogs->revision = 0;
|
||||
return $parsedLogs;
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
class giteaTest
|
||||
{
|
||||
public $tester;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->tester = $tester;
|
||||
$this->gitea = $this->tester->loadModel('gitea');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by id.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByID($id)
|
||||
{
|
||||
$gitea = $this->gitea->getByID($id);
|
||||
if(empty($gitea)) return 0;
|
||||
return $gitea;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gitea list.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getList($orderBy = 'id_desc')
|
||||
{
|
||||
$gitea = $this->gitea->getList($orderBy);
|
||||
if(empty($gitea)) return 0;
|
||||
return array_shift($gitea);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gitea pairs
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPairs()
|
||||
{
|
||||
$pairs = $this->gitea->getPairs();
|
||||
return key($pairs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gitea tasks.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTasks($id)
|
||||
{
|
||||
$tasks = $this->gitea->getTasks($id);
|
||||
if(empty($tasks)) return 0;
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a gitea.
|
||||
*
|
||||
* @access public
|
||||
* @return object|string
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$giteaID = $this->gitea->create();
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
return key($errors);
|
||||
}
|
||||
|
||||
return $this->gitea->getById($giteaID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a gitea.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object|string
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
$this->gitea->update($id);
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
return key($errors);
|
||||
}
|
||||
|
||||
return $this->gitea->getById($id);
|
||||
}
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
<?php
|
||||
class gitlabTest
|
||||
{
|
||||
public $tester;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->tester = $tester;
|
||||
$this->gitlab = $this->tester->loadModel('gitlab');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by id.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByID($id)
|
||||
{
|
||||
$gitlab = $this->gitlab->getByID($id);
|
||||
if(empty($gitlab)) return 0;
|
||||
return $gitlab;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gitlab list.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getList($orderBy = 'id_desc')
|
||||
{
|
||||
$gitlab = $this->gitlab->getList($orderBy);
|
||||
if(empty($gitlab)) return 0;
|
||||
return array_shift($gitlab);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gitlab pairs
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPairs()
|
||||
{
|
||||
$pairs = $this->gitlab->getPairs();
|
||||
return key($pairs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a gitlab.
|
||||
*
|
||||
* @access public
|
||||
* @return object|string
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$gitlabID = $this->gitlab->create();
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
return key($errors);
|
||||
}
|
||||
|
||||
return $this->gitlab->getById($gitlabID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a gitlab.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object|string
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
$this->gitlab->update($id);
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
return key($errors);
|
||||
}
|
||||
|
||||
return $this->gitlab->getById($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage branch privs.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param array $hasAccessBranches
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function manageBranchPrivsTest($gitlabID, $projectID, $hasAccessBranches = array())
|
||||
{
|
||||
$result = $this->gitlab->manageBranchPrivs($gitlabID, $projectID, $hasAccessBranches);
|
||||
return empty($result) ? 'success' : 'fail';
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage tag privs.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param array $hasAccessTags
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function manageTagPrivsTest($gitlabID, $projectID, $hasAccessTags = array())
|
||||
{
|
||||
$result = $this->gitlab->manageTagPrivs($gitlabID, $projectID, $hasAccessTags);
|
||||
return empty($result) ? 'success' : 'fail';
|
||||
}
|
||||
|
||||
/**
|
||||
* Api get signle tag.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param string $tag
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function apiGetSingleTagTest($gitlabID, $projectID, $tag)
|
||||
{
|
||||
return $this->gitlab->apiGetSingleTag($gitlabID, $projectID, $tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gitlab menu.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getGitlabMenuTest($gitlabID, $type = 'project')
|
||||
{
|
||||
$html = $this->gitlab->getGitlabMenu($gitlabID, $type);
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
return key($errors);
|
||||
}
|
||||
|
||||
return substr($html, 0, 4);
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
class gogsTest
|
||||
{
|
||||
public $tester;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->tester = $tester;
|
||||
$this->gogs = $this->tester->loadModel('gogs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by id.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByID($id)
|
||||
{
|
||||
$gogs = $this->gogs->getByID($id);
|
||||
if(empty($gogs)) return 0;
|
||||
return $gogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gogs list.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getList($orderBy = 'id_desc')
|
||||
{
|
||||
$gogs = $this->gogs->getList($orderBy);
|
||||
if(empty($gogs)) return 0;
|
||||
return array_shift($gogs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gogs pairs
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPairs()
|
||||
{
|
||||
$pairs = $this->gogs->getPairs();
|
||||
return key($pairs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a gogs.
|
||||
*
|
||||
* @access public
|
||||
* @return object|string
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$gogsID = $this->gogs->create();
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
return key($errors);
|
||||
}
|
||||
|
||||
return $this->gogs->getById($gogsID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a gogs.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object|string
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
$this->gogs->update($id);
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
return key($errors);
|
||||
}
|
||||
|
||||
return $this->gogs->getById($id);
|
||||
}
|
||||
}
|
||||
@@ -1,473 +0,0 @@
|
||||
<?php
|
||||
class groupTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('group');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a group.
|
||||
*
|
||||
* @param mixed $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createObject($param)
|
||||
{
|
||||
foreach($param as $k => $v) $_POST[$k] = $v;
|
||||
|
||||
$groupID = $this->objectModel->create();
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getById($groupID);
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a group.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updateTest($groupID, $param)
|
||||
{
|
||||
foreach($param as $k => $v) $_POST[$k] = $v;
|
||||
|
||||
$object = $this->objectModel->update($groupID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByID($groupID);
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a group.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function copyTest($groupID, $param)
|
||||
{
|
||||
foreach($param as $k => $v) $_POST[$k] = $v;
|
||||
|
||||
$objects = $this->objectModel->copy($groupID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$newGroupID = $this->objectModel->dao->lastInsertID();
|
||||
$object = $this->objectModel->getByID($newGroupID);
|
||||
|
||||
$this->objectModel->delete($newGroupID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy privileges.
|
||||
*
|
||||
* @param string $fromGroup
|
||||
* @param string $toGroup
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function copyPrivTest($fromGroup, $toGroup)
|
||||
{
|
||||
$objects = $this->objectModel->copyPriv($fromGroup, $toGroup);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$fromPrivs = $this->objectModel->getPrivs($fromGroup);
|
||||
$toPrivs = $this->objectModel->getPrivs($toGroup);
|
||||
|
||||
$result = true;
|
||||
foreach($fromPrivs as $group => $privs)
|
||||
{
|
||||
foreach($privs as $key => $priv)
|
||||
{
|
||||
if(!isset($toPrivs[$group][$key]) or $toPrivs[$group][$key] != $fromPrivs[$group][$key])
|
||||
{
|
||||
$result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy user.
|
||||
*
|
||||
* @param string $fromGroup
|
||||
* @param string $toGroup
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function copyUserTest($fromGroup, $toGroup)
|
||||
{
|
||||
$objects = $this->objectModel->copyUser($fromGroup, $toGroup);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$fromUsers = $this->objectModel->getUserPairs($fromGroup);
|
||||
$toUsers = $this->objectModel->getUserPairs($toGroup);
|
||||
|
||||
$result = true;
|
||||
foreach($fromUsers as $account => $name)
|
||||
{
|
||||
if(!isset($toUsers[$account]) or $toUsers[$account] != $fromUsers[$account])
|
||||
{
|
||||
$result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group lists.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getListTest($projectID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getList($projectID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group pairs.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairsTest($projectID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getPairs($projectID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group by id.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIDTest($groupID)
|
||||
{
|
||||
$objects = $this->objectModel->getByID($groupID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group by account.
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByAccountTest($account)
|
||||
{
|
||||
$objects = $this->objectModel->getByAccount($account);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get groups by accounts.
|
||||
*
|
||||
* @param array $accounts
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByAccountsTest($accounts)
|
||||
{
|
||||
$objects = $this->objectModel->getByAccounts($accounts);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the account number in the group.
|
||||
*
|
||||
* @param array $groupIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getGroupAccountsTest($groupIdList)
|
||||
{
|
||||
$objects = $this->objectModel->getGroupAccounts($groupIdList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get privileges of a groups.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPrivsTest($groupID)
|
||||
{
|
||||
$objects = $this->objectModel->getPrivs($groupID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user pairs of a group.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUserPairsTest($groupID)
|
||||
{
|
||||
$objects = $this->objectModel->getUserPairs($groupID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user programs of a group.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUserProgramsTest($groupID)
|
||||
{
|
||||
$objects = $this->objectModel->getUserPrograms($groupID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID of the group that has access to the program.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getAccessProgramGroupTest()
|
||||
{
|
||||
$objects = $this->objectModel->getAccessProgramGroup();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a group.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @param null $null compatible with that of model::delete()
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteTest($groupID, $null = null)
|
||||
{
|
||||
$this->objectModel->delete($groupID, $null = null);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update privilege of a group.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function updatePrivByGroupTest($groupID, $menu, $version)
|
||||
{
|
||||
$objects = $this->objectModel->updatePrivByGroup($groupID, $menu, $version);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update privilege by module.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updatePrivByModuleTest()
|
||||
{
|
||||
$objects = $this->objectModel->updatePrivByModule();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update users.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updateUserTest($groupID)
|
||||
{
|
||||
$objects = $this->objectModel->updateUser($groupID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update project admins.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updateProjectAdminTest($groupID)
|
||||
{
|
||||
$objects = $this->objectModel->updateProjectAdmin($groupID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort resource.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function sortResourceTest()
|
||||
{
|
||||
$objects = $this->objectModel->sortResource();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check menu have module
|
||||
*
|
||||
* @param string $menu
|
||||
* @param string $moduleName
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function checkMenuModuleTest($menu, $moduleName)
|
||||
{
|
||||
$objects = $this->objectModel->checkMenuModule($menu, $moduleName);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get modules in menu
|
||||
*
|
||||
* @param string $menu
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getMenuModulesTest($menu)
|
||||
{
|
||||
$objects = $this->objectModel->getMenuModules($menu);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取一条权限的基本信息
|
||||
*
|
||||
* @param int $privID
|
||||
* @param string $lang
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getPrivInfoTest($priv, $lang)
|
||||
{
|
||||
$object = $this->objectModel->getPrivInfo($priv, $lang);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取模块和权限包option
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getModuleAndPackageTreeTest()
|
||||
{
|
||||
return $this->objectModel->getModuleAndPackageTree();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新权限
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updatePrivTest($privID,$lang)
|
||||
{
|
||||
$this->objectModel->updatePrivLang($privID,$lang);
|
||||
if(dao::isError())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
<?php
|
||||
class holidayTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('holiday');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getById method.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIdTest($id)
|
||||
{
|
||||
$objects = $this->objectModel->getById($id);
|
||||
|
||||
if($objects === false) return 'Object not found';
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getList method.
|
||||
*
|
||||
* @param string $year
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getListTest($year = '', $type = 'all')
|
||||
{
|
||||
$objects = $this->objectModel->getList($year, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getYearPairs method.
|
||||
*
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getYearPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getYearPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create method.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createTest($param = array())
|
||||
{
|
||||
$defaultParam['type'] = 'holiday';
|
||||
$defaultParam['begin'] = '2022-01-01';
|
||||
$defaultParam['end'] = '2022-02-01';
|
||||
$defaultParam['name'] = '测试创建holiday';
|
||||
$defaultParam['desc'] = '默认的holiday';
|
||||
|
||||
foreach($defaultParam as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
$lastInsertID = $this->objectModel->create();
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$object = $this->objectModel->getByID($lastInsertID);
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update method.
|
||||
*
|
||||
* @param int $holidayID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function updateTest($holidayID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
$object = $tester->dbh->query("SELECT * FROM " . TABLE_HOLIDAY ." WHERE id = $holidayID")->fetch();
|
||||
|
||||
foreach($object as $field => $value)
|
||||
{
|
||||
if(in_array($field, array_keys($param)))
|
||||
{
|
||||
$_POST[$field] = $param[$field];
|
||||
}
|
||||
else
|
||||
{
|
||||
$_POST[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$noError = $this->objectModel->update($bugID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'true';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getHolidays method.
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getHolidaysTest($begin, $end)
|
||||
{
|
||||
$objects = $this->objectModel->getHolidays($begin, $end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getWorkingDays method.
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getWorkingDaysTest($begin = '', $end = '')
|
||||
{
|
||||
$objects = $this->objectModel->getWorkingDays($begin, $end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getActualWorkingDays method.
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getActualWorkingDaysTest($begin, $end)
|
||||
{
|
||||
$objects = $this->objectModel->getActualWorkingDays($begin, $end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getDaysBetweenTest method.
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getDaysBetweenTest($begin, $end)
|
||||
{
|
||||
$objects = $this->objectModel->getDaysBetween($begin, $end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test isHoliday method.
|
||||
*
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function isHolidayTest($date)
|
||||
{
|
||||
$objects = $this->objectModel->isHoliday($date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects === true ? "It is a holiday" : "It is not a holiday";
|
||||
}
|
||||
|
||||
/**
|
||||
* Test isWorkingDay method.
|
||||
*
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function isWorkingDayTest($date)
|
||||
{
|
||||
$objects = $this->objectModel->isWorkingDay($date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test updateProgramPlanDuration method.
|
||||
*
|
||||
* @param int $testProjectID
|
||||
* @param object $holiday
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function updateProgramPlanDurationTest($testProjectID, $holidayID)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$holiday = $tester->dao->select('*')->from(TABLE_HOLIDAY)->where('id')->eq($holidayID)->fetch();
|
||||
|
||||
$this->objectModel->updateProgramPlanDuration($holiday->begin, $holiday->end);
|
||||
|
||||
$project = $tester->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($testProjectID)->fetch();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $project->planDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test updateProjectRealDuration method.
|
||||
*
|
||||
* @param int $testProjectID
|
||||
* @param object $holiday
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function updateProjectRealDurationTest($testProjectID, $holidayID)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$holiday = $tester->dao->select('*')->from(TABLE_HOLIDAY)->where('id')->eq($holidayID)->fetch();
|
||||
|
||||
$this->objectModel->updateProjectRealDuration($holiday->begin, $holiday->end);
|
||||
|
||||
$project = $tester->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($testProjectID)->fetch();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $project->realDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test updateTaskPlanDuration method.
|
||||
*
|
||||
* @param int $testTaskID
|
||||
* @param object $holiday
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function updateTaskPlanDurationTest($testTaskID, $holidayID)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$holiday = $tester->dao->select('*')->from(TABLE_HOLIDAY)->where('id')->eq($holidayID)->fetch();
|
||||
|
||||
$this->objectModel->updateTaskPlanDuration($holiday->begin, $holiday->end);
|
||||
|
||||
$task = $tester->dao->select('*')->from(TABLE_TASK)->where('id')->eq($testTaskID)->fetch();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $task->planDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test updateTaskRealDuration method.
|
||||
*
|
||||
* @param int $testTaskID
|
||||
* @param object $holiday
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function updateTaskRealDurationTest($testTaskID, $holidayID)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$holiday = $tester->dao->select('*')->from(TABLE_HOLIDAY)->where('id')->eq($holidayID)->fetch();
|
||||
|
||||
$this->objectModel->updateTaskRealDuration($holiday->begin, $holiday->end);
|
||||
|
||||
$task = $tester->dao->select('*')->from(TABLE_TASK)->where('id')->eq($testTaskID)->fetch();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $task->realDuration;
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
class jenkinsTest
|
||||
{
|
||||
public $tester;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->tester = $tester;
|
||||
$this->jenkins = $this->tester->loadModel('jenkins');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by id.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByID($id)
|
||||
{
|
||||
$jenkins = $this->jenkins->getByID($id);
|
||||
if(empty($jenkins)) return 0;
|
||||
return $jenkins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jenkins list.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getList($orderBy = 'id_desc')
|
||||
{
|
||||
$jenkins = $this->jenkins->getList($orderBy);
|
||||
if(empty($jenkins)) return 0;
|
||||
return array_shift($jenkins);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jenkins pairs
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPairs()
|
||||
{
|
||||
$pairs = $this->jenkins->getPairs();
|
||||
return key($pairs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jenkins tasks.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTasks($id)
|
||||
{
|
||||
$tasks = $this->jenkins->getTasks($id);
|
||||
if(empty($tasks)) return 0;
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a jenkins.
|
||||
*
|
||||
* @access public
|
||||
* @return object|string
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$jenkinsID = $this->jenkins->create();
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
return key($errors);
|
||||
}
|
||||
|
||||
return $this->jenkins->getById($jenkinsID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a jenkins.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object|string
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
$this->jenkins->update($id);
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
return key($errors);
|
||||
}
|
||||
|
||||
return $this->jenkins->getById($id);
|
||||
}
|
||||
}
|
||||
@@ -1,305 +0,0 @@
|
||||
<?php
|
||||
class jobTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('job');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get job by id.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIdTest($id)
|
||||
{
|
||||
$object = $this->objectModel->getById($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get job list.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param int $pager
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getListTest($orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getList($orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get list by repo id.
|
||||
*
|
||||
* @param int $repoID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getListByRepoIDTest($repoID)
|
||||
{
|
||||
return $this->objectModel->getListByRepoID($repoID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get job pairs.
|
||||
*
|
||||
* @param int $repoID
|
||||
* @param string $engine
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getPairsTest($repoID, $engine = '')
|
||||
{
|
||||
$objects = $this->objectModel->getPairs($repoID, $engine);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get job list by trigger type.
|
||||
*
|
||||
* @param string $triggerType
|
||||
* @param array $repoIdList
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getListByTriggerTypeTest($triggerType, $repoIdList = array())
|
||||
{
|
||||
$objects = $this->objectModel->getListByTriggerType($triggerType, $repoIdList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get trigger config.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getTriggerConfigTest($id)
|
||||
{
|
||||
|
||||
$job = $this->objectModel->getById($id);
|
||||
|
||||
$object = $this->objectModel->getTriggerConfig($job);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get trigger group.
|
||||
*
|
||||
* @param string $triggerType
|
||||
* @param array $repoIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTriggerGroupTest($triggerType, $repoIdList)
|
||||
{
|
||||
$array = $this->objectModel->getTriggerGroup($triggerType, $repoIdList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$group = array();
|
||||
if($triggerType == 'tag') $group = isset($array[1]) ? $array[1] : array();
|
||||
if($triggerType == 'commit') $group = isset($array[2]) ? $array[2] : array();
|
||||
|
||||
return $group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create object.
|
||||
*
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createObject($params)
|
||||
{
|
||||
$createFields['name'] = '这是一个JOB3';
|
||||
$createFields['engine'] = 'gitlab';
|
||||
$createFields['repo'] = '1';
|
||||
$createFields['reference'] = 'test_case';
|
||||
$createFields['product'] = '1';
|
||||
$createFields['frame'] = 'phpunit';
|
||||
$createFields['triggerType'] = 'commit';
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
|
||||
foreach($params as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectID = $this->objectModel->create();
|
||||
unset($_POST);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByID($objectID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update object.
|
||||
*
|
||||
* @param int $jobId
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function updateObject($jobId, $params = array())
|
||||
{
|
||||
global $tester;
|
||||
$object = $tester->dbh->query("SELECT * FROM " . TABLE_JOB ." WHERE id = $jobId")->fetch();
|
||||
|
||||
foreach($object as $field => $value)
|
||||
{
|
||||
if(in_array($field, array_keys($params)))
|
||||
{
|
||||
$_POST[$field] = $params[$field];
|
||||
}
|
||||
else
|
||||
{
|
||||
$_POST[$field] = $value;
|
||||
}
|
||||
}
|
||||
$_POST['jkServer'] = 3;
|
||||
$_POST['jkTask'] = 'dave';
|
||||
|
||||
$result = $this->objectModel->update($jobId);
|
||||
unset($_POST);
|
||||
if(dao::isError()) return dao::getError()[0];
|
||||
|
||||
return $result ? 'Job更新成功' : 'Job更新失败';
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exec job.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $extraParam
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function execTest($id, $extraParam = array())
|
||||
{
|
||||
$object = $this->objectModel->exec($id, $extraParam);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exec jenkins pipeline.
|
||||
*
|
||||
* @param int $jobID
|
||||
* @param object $repo
|
||||
* @param int $compileID
|
||||
* @param array $extraParam
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function execJenkinsPipelineTest($jobID, $repo, $compileID, $extraParam = array())
|
||||
{
|
||||
$job = $this->objectModel->getById($jobID);
|
||||
|
||||
$object = $this->objectModel->execJenkinsPipeline($job, $repo, $compileID, $extraParam);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exec gitlab pipeline.
|
||||
*
|
||||
* @param int $jobID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function execGitlabPipelineTest($jobID)
|
||||
{
|
||||
$job = $this->objectModel->getById($jobID);
|
||||
|
||||
$object = $this->objectModel->execGitlabPipeline($job);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get last tag by repo.
|
||||
*
|
||||
* @param int $repoId
|
||||
* @param int $jobId
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getLastTagByRepoTest($jobId)
|
||||
{
|
||||
global $tester;
|
||||
$job = $this->objectModel->getById($jobId);
|
||||
$repo = $tester->loadModel('repo')->getRepoById($job->repo);
|
||||
$object = $this->objectModel->getLastTagByRepo($repo, $job);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get sonarqube by RepoID.
|
||||
*
|
||||
* @param array $repoIDList
|
||||
* @param int $jobID
|
||||
* @param bool $showDeleted
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getSonarqubeByRepoTest($repoIDList, $jobID = 0, $showDeleted = false)
|
||||
{
|
||||
$array = $this->objectModel->getSonarqubeByRepo($repoIDList, $jobID, $showDeleted);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get job pairs by sonarqube projectkeys.
|
||||
*
|
||||
* @param int $sonarqubeID
|
||||
* @param array $projectKeys
|
||||
* @param bool $emptyShowAll
|
||||
* @param bool $showDeleted
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getJobBySonarqubeProjectTest($sonarqubeID, $projectKeys = array(), $emptyShowAll = false, $showDeleted = false)
|
||||
{
|
||||
$array = $this->objectModel->getJobBySonarqubeProject($sonarqubeID, $projectKeys, $emptyShowAll, $showDeleted);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,299 +0,0 @@
|
||||
<?php
|
||||
class mailTest
|
||||
{
|
||||
/**
|
||||
* __construct.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
global $dao;
|
||||
$this->dao = $dao;
|
||||
$this->tester = $tester;
|
||||
$this->objectModel = $tester->loadModel('mail');
|
||||
}
|
||||
|
||||
/**
|
||||
* AutoDetect.
|
||||
*
|
||||
* @param int $email
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function autoDetectTest($email)
|
||||
{
|
||||
$objects = $this->objectModel->autoDetect($email);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
if(!$objects->host) return '没有检测到相关信息';
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config from provider.
|
||||
*
|
||||
* @param int $domain
|
||||
* @param int $username
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getConfigFromProviderTest($domain, $username)
|
||||
{
|
||||
$object = $this->objectModel->getConfigFromProvider($domain, $username);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config by MXRR.
|
||||
*
|
||||
* @param int $domain
|
||||
* @param int $username
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getConfigByMXRRTest($domain, $username)
|
||||
{
|
||||
$object = $this->objectModel->getConfigByMXRR($domain, $username);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config by detecting SMTP.
|
||||
*
|
||||
* @param int $domain
|
||||
* @param int $username
|
||||
* @param int $port
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getConfigByDetectingSMTPTest($domain, $username, $port)
|
||||
{
|
||||
$object = $this->objectModel->getConfigByDetectingSMTP($domain, $username, $port);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set MTA.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setMTATest()
|
||||
{
|
||||
$object = $this->objectModel->setMTA();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sendmail.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setSendMailTest()
|
||||
{
|
||||
$object = $this->objectModel->setSendMail();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send.
|
||||
*
|
||||
* @param int $toList
|
||||
* @param int $subject
|
||||
* @param string $body
|
||||
* @param string $ccList
|
||||
* @param int $includeMe
|
||||
* @param array $emails
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function sendTest($toList, $subject, $body = '', $ccList = '', $includeMe = false, $emails = array())
|
||||
{
|
||||
$object = $this->objectModel->send($toList, $subject, $body, $ccList, $includeMe, $emails);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set CC.
|
||||
*
|
||||
* @param int $ccList
|
||||
* @param int $emails
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setCCTest($ccList, $emails)
|
||||
{
|
||||
$this->objectModel->setCC($ccList, $emails);
|
||||
|
||||
return $this->setMTATest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set subject.
|
||||
*
|
||||
* @param int $subject
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setSubjectTest($subject)
|
||||
{
|
||||
$this->objectModel->setSubject($subject);
|
||||
|
||||
return $this->setMTATest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set body.
|
||||
*
|
||||
* @param int $body
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setBodyTest($body)
|
||||
{
|
||||
$this->objectModel->setBody($body);
|
||||
|
||||
return $this->setMTATest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mail exist.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function mailExistTest()
|
||||
{
|
||||
$object = $this->objectModel->mailExist();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add queue.
|
||||
*
|
||||
* @param int $toList
|
||||
* @param int $subject
|
||||
* @param string $body
|
||||
* @param string $ccList
|
||||
* @param int $includeMe
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function addQueueTest($toList, $subject, $body = '', $ccList = '', $includeMe = false)
|
||||
{
|
||||
$this->objectModel->addQueue($toList, $subject, $body, $ccList, $includeMe);
|
||||
|
||||
if($toList and $subject)
|
||||
{
|
||||
$id = $this->dao->lastInsertID();
|
||||
$object = $this->dao->select('*')->from(TABLE_NOTIFY)->where('id')->eq($id)->fetch();
|
||||
}
|
||||
|
||||
if(!$object) return '没有数据提交';
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get queue.
|
||||
*
|
||||
* @param string $status
|
||||
* @param string $orderBy
|
||||
* @param int $pager
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getQueueTest($status = '', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getQueue($status = '', $orderBy = 'id_desc', $pager = null);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get queue by id.
|
||||
*
|
||||
* @param int $queueID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getQueueByIdTest($queueID)
|
||||
{
|
||||
$object = $this->objectModel->getQueueById($queueID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge mails.
|
||||
*
|
||||
* @param int $user
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function mergeMailsTest($user)
|
||||
{
|
||||
$mails = $this->dao->select('*')->from(TABLE_NOTIFY)
|
||||
->where('objectType')->eq('mail')
|
||||
->andWhere('toList')->eq($user)
|
||||
->fetchAll();
|
||||
|
||||
$object = $this->objectModel->mergeMails($mails);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subject.
|
||||
*
|
||||
* @param int $objectType
|
||||
* @param int $object
|
||||
* @param int $title
|
||||
* @param int $actionType
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getSubjectTest($objectType, $object, $title, $actionType)
|
||||
{
|
||||
$object = $this->tester->loadModel($objectType)->getByID($object);
|
||||
$object = $this->objectModel->getSubject($objectType, $object, $title, $actionType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
<?php
|
||||
class messageTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('message');
|
||||
}
|
||||
|
||||
public function getMessagesTest($status)
|
||||
{
|
||||
$objects = $this->objectModel->getMessages($status);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get objectTypes.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getObjectTypesTest()
|
||||
{
|
||||
$objects = $this->objectModel->getObjectTypes();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object actions.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getObjectActionsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getObjectActions();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check send.
|
||||
*
|
||||
* @param int $objectType
|
||||
* @param int $objectID
|
||||
* @param int $actionType
|
||||
* @param int $actionID
|
||||
* @param string $actor
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function sendTest($objectType, $objectID, $actionType, $actionID, $actor = '')
|
||||
{
|
||||
$objects = $this->objectModel->send($objectType, $objectID, $actionType, $actionID, $actor = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save notice.
|
||||
*
|
||||
* @param int $objectType
|
||||
* @param int $objectID
|
||||
* @param int $actionType
|
||||
* @param int $actionID
|
||||
* @param string $actor
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function saveNoticeTest($objectType, $objectID, $actionType, $actionID, $actor = '')
|
||||
{
|
||||
$objects = $this->objectModel->saveNotice($objectType, $objectID, $actionType, $actionID, $actor = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get toList.
|
||||
*
|
||||
* @param int $objectType
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getToListTest($objectType)
|
||||
{
|
||||
global $tester;
|
||||
$table = $tester->config->objectTables[$objectType];
|
||||
$object = $tester->dao->select('*')->from($table)->where('id')->eq('1')->fetch();
|
||||
$objects = $this->objectModel->getToList($object, $objectType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get notice todos.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getNoticeTodosTest()
|
||||
{
|
||||
$objects = $this->objectModel->getNoticeTodos();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
class Misc
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
su($user);
|
||||
$this->misc = $tester->loadModel('misc');
|
||||
}
|
||||
|
||||
/**
|
||||
* hello
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function hello()
|
||||
{
|
||||
$miscs = $this->misc->hello();
|
||||
return $miscs;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTableAndStatus
|
||||
* 传入参数来获取表状态
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTableAndStatus($type = 'check')
|
||||
{
|
||||
$miscs = $this->misc->getTableAndStatus($type = 'check');
|
||||
return $miscs;
|
||||
}
|
||||
|
||||
/**
|
||||
* getRemind
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getRemind()
|
||||
{
|
||||
$miscs = $this->misc->getRemind();
|
||||
return $miscs;
|
||||
}
|
||||
|
||||
/**
|
||||
* checkOneClickPackage
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function checkOneClickPackage()
|
||||
{
|
||||
$miscs = $this->misc->checkOneClickPackage();
|
||||
return $miscs;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,213 +0,0 @@
|
||||
<?php
|
||||
class myTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('my');
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getProducts test by my
|
||||
*
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getProductsTest($type)
|
||||
{
|
||||
$objects = $this->objectModel->getProducts($type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getDoingProjects test by my
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getDoingProjectsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getDoingProjects();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getOverview test by my
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getOverviewTest()
|
||||
{
|
||||
$objects = $this->objectModel->getOverview();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getContribute test by my
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getContributeTest()
|
||||
{
|
||||
$objects = $this->objectModel->getContribute();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getActions test by my
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getActionsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getActions();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getAssignedByMe test by my
|
||||
*
|
||||
* @param string $account
|
||||
* @param int $limit
|
||||
* @param int $pager
|
||||
* @param string $orderBy
|
||||
* @param int $projectID
|
||||
* @param string $objectType
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getAssignedByMeTest($account, $limit, $pager, $orderBy, $projectID, $objectType)
|
||||
{
|
||||
global $tester;
|
||||
$recTotal = 0;
|
||||
$recPerPage = 20;
|
||||
$pageID = 0;
|
||||
$tester->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$objects = $this->objectModel->getAssignedByMe($account, $limit, $pager, $orderBy, $objectType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get testcases by search.
|
||||
*
|
||||
* @param int $queryID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTestcasesBySearchTest($queryID, $type, $orderBy)
|
||||
{
|
||||
global $tester;
|
||||
$recTotal = 0;
|
||||
$recPerPage = 20;
|
||||
$pageID = 0;
|
||||
$tester->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$objects = $this->objectModel->getTestcasesBySearch($query, $type, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tasks by search.
|
||||
*
|
||||
* @param string $account
|
||||
* @param int $limit
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTasksBySearchTest($account, $limit = 0)
|
||||
{
|
||||
global $tester;
|
||||
$recTotal = 0;
|
||||
$recPerPage = 20;
|
||||
$pageID = 0;
|
||||
$tester->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$objects = $this->objectModel->getTasksBySearch($account, $limit, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get stories by search.
|
||||
*
|
||||
* @param int $queryID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStoriesBySearchTest($queryID, $type, $orderBy)
|
||||
{
|
||||
global $tester;
|
||||
$recTotal = 0;
|
||||
$recPerPage = 1;
|
||||
$pageID = 0;
|
||||
$tester->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$objects = $this->objectModel->getStoriesBySearch($queryID, $type, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get requirements by search.
|
||||
*
|
||||
* @param int $queryID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getRequirementsBySearchTest($queryID, $type, $orderBy)
|
||||
{
|
||||
global $tester;
|
||||
$recTotal = 0;
|
||||
$recPerPage = 1;
|
||||
$pageID = 0;
|
||||
$tester->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$objects = $this->objectModel->getRequirementsBySearch($queryID, $type, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,337 +0,0 @@
|
||||
<?php
|
||||
class personnelTest
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
su($user);
|
||||
$this->objectModel = $tester->loadModel('personnel');
|
||||
$tester->app->loadClass('dao');
|
||||
}
|
||||
/**
|
||||
* Get accessible personnel test
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $deptID
|
||||
* @param string $browseType
|
||||
* @param int $queryID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getAccessiblePersonnelTest($programID = 0, $deptID = 0, $browseType = 'all', $queryID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getAccessiblePersonnel($programID, $deptID, $browseType, $queryID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if you have permission to view the program
|
||||
*
|
||||
* @param int mixed $programID
|
||||
* @param string mixed $account
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function canViewProgramTest($programID, $account)
|
||||
{
|
||||
$objects = $this->objectModel->canViewProgram($programID, $account);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get invest test
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getInvestTest($programID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getInvest($programID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getInvolvedProjectsTest($projects)
|
||||
{
|
||||
global $tester;
|
||||
$projectID = $tester->dao->select('id')->from(TABLE_PROJECT)->where('id')->in($projects)->fetchall('id');
|
||||
$objects = $this->objectModel->getInvolvedProjects($projectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get involved executions test
|
||||
*
|
||||
* @param array mixed $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getInvolvedExecutionsTest($projectID)
|
||||
{
|
||||
global $tester;
|
||||
$project = $tester->dao->select('id')->from(TABLE_PROJECT)->where('id')->in($projectID)->fetchall('id');
|
||||
$objects = $this->objectModel->getInvolvedExecutions($project);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project task invest test
|
||||
*
|
||||
* @param array mixed $projects
|
||||
* @param array mixed $accounts
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProjectTaskInvestTest($projectID, $accounts)
|
||||
{
|
||||
global $tester;
|
||||
$project = $tester->dao->select('id')->from(TABLE_PROJECT)->where('id')->in($projectID)->fetchall('id');
|
||||
$objects = $this->objectModel->getProjectTaskInvest($project, $accounts);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetUserHoursTest
|
||||
*
|
||||
* @param mixed $projectID
|
||||
* @param array $accounts
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getUserHoursTest($projectID, $accounts)
|
||||
{
|
||||
global $tester;
|
||||
$projects = $tester->dao->select('id')->from(TABLE_PROJECT)->where('id')->in($projectID)->fetchall('id');
|
||||
$tasks = $tester->dao->select('id,status,openedBy,finishedBy,assignedTo,project')->from(TABLE_TASK)
|
||||
->where('project')->in(array_keys($projects))
|
||||
->andWhere('deleted')->eq('0')
|
||||
->fetchAll('id');
|
||||
|
||||
/* Initialize personnel related tasks. */
|
||||
$invest = array();
|
||||
foreach($accounts as $account)
|
||||
{
|
||||
$invest[$account]['createdTask'] = 0;
|
||||
$invest[$account]['finishedTask'] = 0;
|
||||
$invest[$account]['pendingTask'] = 0;
|
||||
$invest[$account]['consumedTask'] = 0;
|
||||
$invest[$account]['leftTask'] = 0;
|
||||
}
|
||||
|
||||
$userTasks = array();
|
||||
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if($task->openedBy && isset($invest[$task->openedBy]))
|
||||
{
|
||||
$invest[$task->openedBy]['createdTask'] += 1;
|
||||
$userTasks[$task->openedBy][$task->id] = $task->id;
|
||||
}
|
||||
|
||||
if($task->finishedBy && isset($invest[$task->finishedBy]))
|
||||
{
|
||||
$invest[$task->finishedBy]['finishedTask'] += 1;
|
||||
$userTasks[$task->finishedBy][$task->id] = $task->id;
|
||||
}
|
||||
|
||||
if($task->assignedTo && $task->status == 'wait' && isset($invest[$task->assignedTo]))
|
||||
{
|
||||
$invest[$task->assignedTo]['pendingTask'] += 1;
|
||||
$userTasks[$task->assignedTo][$task->id] = $task->id;
|
||||
}
|
||||
}
|
||||
|
||||
$objects = $this->objectModel->getUserHours($userTasks);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whitelist test
|
||||
*
|
||||
* @param int $objectID
|
||||
* @param string $objectType
|
||||
* @param string $orderBy
|
||||
* @param string $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getWhitelistTest($objectID = 0, $objectType = '', $orderBy = 'id_desc', $pager = '')
|
||||
{
|
||||
$objects = $this->objectModel->getWhitelist($objectID, $objectType, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whitelist account test
|
||||
*
|
||||
* @param int $objectID
|
||||
* @param string $objectType
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getWhitelistAccountTest($objectID = 0, $objectType = '')
|
||||
{
|
||||
$objects = $this->objectModel->getWhitelistAccount($objectID, $objectType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function updateWhitelistTest($users = array(), $objectType = '', $objectID = 0, $type = 'whitelist', $source = 'add', $updateType = 'replace')
|
||||
{
|
||||
$objects = $this->objectModel->updateWhitelist($users, $objectType, $objectID, $type, $source, $updateType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add whitelist test
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param array mixed $user
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function addWhitelistTest($objectType = '', $objectID = 0, $user = '')
|
||||
{
|
||||
$users = array('accounts' => $user);
|
||||
foreach($users as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->addWhitelist($objectType, $objectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete product whitelist Test
|
||||
*
|
||||
* @param int mixed $productID
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteProductWhitelistTest($productID, $account = '')
|
||||
{
|
||||
global $tester;
|
||||
$this->addWhitelistTest('product', $productID, array('admin'));
|
||||
$tester->dao->update(TABLE_ACL)->set('source')->eq('sync')->where('objectID')->eq($productID)->andWhere('objectType')->eq('product')->exec();
|
||||
|
||||
$objects = $this->objectModel->deleteProductWhitelist($productID, $account);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete program whitelist Test
|
||||
*
|
||||
* @param int $programID
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteProgramWhitelistTest($programID, $account)
|
||||
{
|
||||
global $tester;
|
||||
$this->addWhitelistTest('program', $programID, array($account));
|
||||
$tester->dao->update(TABLE_ACL)->set('source')->eq('sync')->where('objectID')->eq($programID)->andWhere('objectType')->eq('program')->exec();
|
||||
$objects = $this->objectModel->deleteProgramWhitelist($programID, $account);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete project whitelist Test
|
||||
*
|
||||
* @param int mixed $objectID
|
||||
* @param string mixed $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteProjectWhitelistTest($objectID, $account)
|
||||
{
|
||||
global $tester;
|
||||
$this->addWhitelistTest('project', $objectID, array($account));
|
||||
$tester->dao->update(TABLE_ACL)->set('source')->eq('sync')->where('objectID')->eq($objectID)->andWhere('objectType')->eq('project')->exec();
|
||||
$objects = $this->objectModel->deleteProjectWhitelist($objectID, $account);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete execution whitelist Test
|
||||
*
|
||||
* @param int mixed $executionID
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteExecutionWhitelistTest($executionID, $account = '')
|
||||
{
|
||||
global $tester;
|
||||
$this->addWhitelistTest('sprint', $executionID, array($account));
|
||||
$tester->dao->update(TABLE_ACL)->set('source')->eq('sync')->where('objectID')->eq($executionID)->andWhere('objectType')->eq('sprint')->exec();
|
||||
$objects = $this->objectModel->deleteExecutionWhitelist($executionID, $account);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete whitelist Test
|
||||
*
|
||||
* @param array $users
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function deleteWhitelistTest($users = array(), $objectType = 'program', $objectID = 0, $groupID = 0)
|
||||
{
|
||||
global $tester;
|
||||
$this->addWhitelistTest($objectType, $objectID, $users);
|
||||
$tester->dao->update(TABLE_ACL)->set('source')->eq('sync')->where('objectID')->eq($objectID)->andWhere('objectType')->eq($objectType)->exec();
|
||||
$objects = $this->objectModel->deleteWhitelist($users, $objectType, $objectID, $groupID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
<?php
|
||||
class pipelineTest
|
||||
{
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$this->objectModel = $tester->loadModel('pipeline');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pipeline by id.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIDTest($id)
|
||||
{
|
||||
$objects = $this->objectModel->getByID($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pipeline list.
|
||||
*
|
||||
* @param string $type jenkins|gitlab
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getListTest($type = 'jenkins', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getList($type, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pipeline pairs
|
||||
*
|
||||
* @param int $data
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairs($data)
|
||||
{
|
||||
$objects = $this->objectModel->getPairs($data['type']);
|
||||
|
||||
if(empty($objects)) return '没有获取到数据';
|
||||
if(isset($data['id'])) return $objects[$data['id']];
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a pipeline.
|
||||
*
|
||||
* @param int $type
|
||||
* @param int $param
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createTest($type, $param)
|
||||
{
|
||||
foreach($param as $k => $v) $_POST[$k] = $v;
|
||||
$objects = $this->objectModel->create($type);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getById($objects);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a pipeline.
|
||||
*
|
||||
* @param int $id
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function updateTest($id)
|
||||
{
|
||||
$objects = $this->objectModel->update($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($id);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete one record.
|
||||
*
|
||||
* @param string $id the id to be deleted
|
||||
* @param string $object the action object
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function deleteTest($id, $object = 'gitlab')
|
||||
{
|
||||
$objects = $this->objectModel->delete($id, $object = 'gitlab');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getById($id);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,461 +0,0 @@
|
||||
<?php
|
||||
class productPlan
|
||||
{
|
||||
public function __construct($user)
|
||||
{
|
||||
global $tester;
|
||||
su($user);
|
||||
$this->productplan = $tester->loadModel('productplan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by ID plan
|
||||
*
|
||||
* @param int mixed $planID
|
||||
* @param bool mixed $setImgSize
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByIDPlan($planID, $setImgSize = false)
|
||||
{
|
||||
$productplans = $this->productplan->getByID($planID, $setImgSize = false);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by ID list
|
||||
*
|
||||
* @param array(int) mixed $planIDList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByIDList($planIDList)
|
||||
{
|
||||
$productplans = $this->productplan->getByIDList($planIDList);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last
|
||||
*
|
||||
* @param int mixed $productID
|
||||
* @param int $branch
|
||||
* @param int $parent
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLast($productID, $branch = 0, $parent = 0)
|
||||
{
|
||||
$productplans = $this->productplan->getLast($productID, $parent);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list
|
||||
*
|
||||
* @param int $product
|
||||
* @param int $branch
|
||||
* @param string $browseType
|
||||
* @param mixed $pager
|
||||
* @param string $orderBy
|
||||
* @param string $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getList($product = 0, $branch = 0, $browseType = 'undone', $pager = null, $orderBy = 'begin_desc', $param = '')
|
||||
{
|
||||
$productplans = $this->productplan->getList($product, $branch, $browseType, $pager, $orderBy, $param);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pairs
|
||||
*
|
||||
* @param int $product
|
||||
* @param string $branch
|
||||
* @param string $expired
|
||||
* @param bool mixed $skipParent
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairs($product, $branch = '', $expired = '', $skipParent = false)
|
||||
{
|
||||
$productplans = $this->productplan->getPairs($product, $branch = '', $expired = '', $skipParent = false);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pairs for story
|
||||
*
|
||||
* @param mrray|int mixed $product
|
||||
* @param int mixed $branch
|
||||
* @param string mixed $param
|
||||
* @access public
|
||||
* @return count
|
||||
*/
|
||||
public function getPairsForStory($product, $branch, $param)
|
||||
{
|
||||
$productplans = $this->productplan->getPairsForStory($product, $branch, $param);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return count($productplans) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get for products
|
||||
*
|
||||
* @param array(int) mixed $products
|
||||
* @access public
|
||||
* @return count
|
||||
*/
|
||||
public function getForProducts($products)
|
||||
{
|
||||
$productplans = $this->productplan->getForProducts($products);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group by product
|
||||
*
|
||||
* @param array(int) mixed $products
|
||||
* @param string mixed $param
|
||||
* @param string $field
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return count
|
||||
*/
|
||||
public function getGroupByProduct($products, $param, $field = 'name', $orderBy = 'id_desc')
|
||||
{
|
||||
$productplans = $this->productplan->getGroupByProduct($products, $param, $field, $orderBy);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return count($productplans);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get children
|
||||
*
|
||||
* @param int mixed $planID
|
||||
* @access public
|
||||
* @return count
|
||||
*/
|
||||
public function getChildren($planID)
|
||||
{
|
||||
$productplans = $this->productplan->getChildren($planID);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return count($productplans);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plans by stories
|
||||
*
|
||||
* @param array(int) mixed $storyIdList
|
||||
* @access public
|
||||
* @return count
|
||||
*/
|
||||
public function getPlansByStories($storyIdList)
|
||||
{
|
||||
$productplans = $this->productplan->getPlansByStories($storyIdList);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return count($productplans);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get branch plan pairs
|
||||
*
|
||||
* @param int mixed $productID
|
||||
* @param int mixed $branches
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBranchPlanPairs($productID, $branches)
|
||||
{
|
||||
$productplans = $this->productplan->getBranchPlanPairs($productID, $branches);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get top plan pairs
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param int $exclude
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTopPlanPairsTest($param)
|
||||
{
|
||||
$productID = $param['productID'];
|
||||
$branch = $param['branch'];
|
||||
$exclude = $param['exclude'];
|
||||
|
||||
$planPairs = $this->productplan->getTopPlanPairs($productID, $branch, $exclude);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $planPairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create
|
||||
*
|
||||
* @param array mixed $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function create($param)
|
||||
{
|
||||
//初始化传的参数,这里可以设置默认值
|
||||
$createPlan = array('title' => '', 'begin' => '', 'end' => '', 'delta' => '', 'desc' => '', 'uid' => '', 'product' => '', 'parent' => '');
|
||||
//设置foreach循环,将初始化参数传给全局变量$_POST中,通过此方式将传的参数提供给源码create方法
|
||||
foreach($createPlan as $field => $defaultvalue) $_POST[$field] = $defaultvalue;
|
||||
//二次遍历数组将此方法的形参传入$_POST中,这行可以替换掉初始化参数,做到以传入参数为最终结果的目的。同时不传参数的话取默认值
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
//这行代码的作用是调用源码中的方法(参数通过$_POST直接取,具体原理可以不知道)
|
||||
$productPlans = $this->productplan->create();
|
||||
//将方法返回内容返回
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productPlans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update
|
||||
*
|
||||
* @param int mixed $planID
|
||||
* @param array mixed $values
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function update($planID, $values)
|
||||
{
|
||||
$updatePlan = array('title' => '', 'status' => '', 'begin' => '', 'end' => '', 'desc' => '', 'uid' => '', 'product' => '');
|
||||
|
||||
foreach($updatePlan as $field => $defaultvalue) $_POST[$field] = $defaultvalue;
|
||||
foreach($values as $key =>$value) $_POST[$key] = $value;
|
||||
|
||||
$productplans = $this->productplan->update($planID);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update status
|
||||
*
|
||||
* @param int mixed $planID
|
||||
* @param string $status
|
||||
* @param string $action
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateStatus($planID, $status = '', $action = '')
|
||||
{
|
||||
$productplans = $this->productplan->updateStatus($planID, $status, $action);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update parent status
|
||||
*
|
||||
* @param int mixed $parentId
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function updateParentStatus($parentId)
|
||||
{
|
||||
$productplans = $this->productplan->updateParentStatus($parentId);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch update
|
||||
*
|
||||
* @param int mixed $productId
|
||||
* @access public
|
||||
* @return array(array)
|
||||
*/
|
||||
public function batchUpdate($productId, $bratch)
|
||||
{
|
||||
$batch = array('id' => array(), 'title' => array(), 'begin' => array(), 'end' => array());
|
||||
|
||||
foreach($batch as $field => $defaultvalue) $_POST[$field] = $defaultvalue;
|
||||
foreach($bratch as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$productplans = $this->productplan->batchUpdate($productId);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch change status
|
||||
*
|
||||
* @param string mixed $status
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchChangeStatus($status, $planIDList = array('planIDList' => array(4, 5)))
|
||||
{
|
||||
$planID = $planIDList;
|
||||
|
||||
foreach($planID as $field => $defaultvalue) $_POST[$field] = $defaultvalue;
|
||||
|
||||
$productplans = $this->productplan->batchChangeStatus($status);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change parent field
|
||||
*
|
||||
* @param int mixed $planID
|
||||
* @access public
|
||||
* @return true
|
||||
*/
|
||||
public function changeParentField($planID)
|
||||
{
|
||||
$productplans = $this->productplan->changeParentField($planID);
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Link story
|
||||
*
|
||||
* @param int mixed $planID
|
||||
* @param array(stories => array())mixed $storyID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkStory($planID, $storyID)
|
||||
{
|
||||
|
||||
foreach($storyID as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$productplans = $this->productplan->linkStory($planID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlink story
|
||||
*
|
||||
* @param int mixed $storyID
|
||||
* @param int mixed $planID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function unlinkStory($storyID, $planID)
|
||||
{
|
||||
$productPlans = $this->productplan->unlinkStory($storyID, $planID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $productPlans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Link bug
|
||||
*
|
||||
* @param int mixed $planID
|
||||
* @param array mixed $bugID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkBug($planID, $bugID)
|
||||
{
|
||||
|
||||
foreach($bugID as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$productPlans = $this->productplan->linkBug($planID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $productPlans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlink bug
|
||||
*
|
||||
* @param int mixed $bugID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function unlinkBug($bugID)
|
||||
{
|
||||
$productplans = $this->productplan->unlinkBug($bugID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Link project
|
||||
*
|
||||
* @param $projectID mixed $projectID
|
||||
* @param $newPlans mixed $newPlans
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkProject($projectID, $newPlans)
|
||||
{
|
||||
$productplans = $this->productplan->linkProject($projectID, $newPlans);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reorder 4 children
|
||||
*
|
||||
* @param array mixed $plans
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function reorder4Children($plans)
|
||||
{
|
||||
$plan = $this->productplan->dao->select('*')->from(TABLE_PRODUCTPLAN)
|
||||
->where('id')->in($plans)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchAll('id');
|
||||
|
||||
$productplans = $this->productplan->reorder4Children($plan);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is clickable
|
||||
*
|
||||
* @param int mixed $planID
|
||||
* @param string mixed $action
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function isClickable($planID, $action)
|
||||
{
|
||||
$plan = $this->productplan->dao->select('*')->from(TABLE_PRODUCTPLAN)
|
||||
->where('id')->eq($planID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchAll('id');
|
||||
|
||||
$plans = $plan[$planID];
|
||||
$productplans = $this->productplan->isClickable($plans, $action);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $productplans;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,451 +0,0 @@
|
||||
<?php
|
||||
class programTest
|
||||
{
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* @param mixed $user
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$this->program = $tester->loadModel('program');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get switcher.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSwitcherTest($programID = 0)
|
||||
{
|
||||
return $this->program->getSwitcher($programID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list by search.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param int $queryID
|
||||
* @param string $sql
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getListBySearchTest($orderBy = 'id_asc', $queryID = 0, $sql = '')
|
||||
{
|
||||
if(!empty($sql)) $_SESSION['programQuery'] = $sql;
|
||||
|
||||
return $this->program->getListBySearch($orderBy, $queryID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pairs.
|
||||
*
|
||||
* @param bool $isQueryAll
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairsTest($isQueryAll = false, $orderBy = 'id_desc')
|
||||
{
|
||||
return $this->program->getPairs($isQueryAll, $orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pairs by id list.
|
||||
*
|
||||
* @param string $programIDList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairsByListTest($programIDList = '')
|
||||
{
|
||||
return $this->program->getPairsByList($programIDList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parent pairs.
|
||||
*
|
||||
* @param string $model
|
||||
* @param string $mode
|
||||
* @param bool $showRoot
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getParentPairsTest($model = '', $mode = 'noclosed', $showRoot = true)
|
||||
{
|
||||
return $this->program->getParentPairs($model, $mode, $showRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the product associated with the program.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param string $mode
|
||||
* @param string $status
|
||||
* @param string|array $append
|
||||
* @param int|string $shadow
|
||||
* @param bool $withProgram
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProductPairsTest($programID = 0, $mode = 'assign', $status = 'all', $append = '', $shadow = 0, $withProgram = false)
|
||||
{
|
||||
return $this->program->getProductPairs($programID, $mode, $status, $append, $shadow, $withProgram);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create program.
|
||||
*
|
||||
* @param array $data
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createTest($data)
|
||||
{
|
||||
$_POST = $data;
|
||||
|
||||
$programID = $this->program->create();
|
||||
|
||||
if(dao::isError()) return array('message' => dao::getError());
|
||||
|
||||
$program = $this->program->getByID($programID);
|
||||
|
||||
return $program;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parent PM.
|
||||
*
|
||||
* @param array $programIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getParentPMTest($programIdList)
|
||||
{
|
||||
return $this->program->getParentPM($programIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create stakeholder.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param array $accounts
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createStakeholderTest($programID, $accounts = array())
|
||||
{
|
||||
$_POST['accounts'] = $accounts;
|
||||
$stakeHolder = $this->program->createStakeholder($programID);
|
||||
|
||||
return $this->program->getStakeholdersByPrograms($programID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create default program.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createDefaultProgramTest()
|
||||
{
|
||||
$programID = $this->program->createDefaultProgram();
|
||||
|
||||
return $programID > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get list.
|
||||
*
|
||||
* @param mixed $status
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param string $type top|child
|
||||
* @param mixed $idList
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getListTest($status = 'all', $orderBy = 'id_asc', $pager = NULL, $type = '', $idList = '')
|
||||
{
|
||||
$this->program->cookie->showClosed = 'ture';
|
||||
$programs = $this->program->getList($status, $orderBy, $pager, $type, $idList);
|
||||
|
||||
if(dao::isError()) return array('message' => dao::getError());
|
||||
|
||||
return $programs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test update program.
|
||||
*
|
||||
* @param mixed $proguamID
|
||||
* @param mixed $data
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updateTest($programID, $data)
|
||||
{
|
||||
$_POST = $data;
|
||||
$this->program->update($programID);
|
||||
if(dao::isError()) return array('message' => dao::getError());
|
||||
|
||||
return $this->program->getByID($programID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get program by id.
|
||||
*
|
||||
* @param int $proguamID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIDTest($programID)
|
||||
{
|
||||
$program = $this->program->getByID($programID);
|
||||
if(dao::isError()) return array('message' => dao::getError());
|
||||
|
||||
return $program;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get budget left.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getBudgetLeftTest($programID)
|
||||
{
|
||||
$program = $this->program->getByID($programID);
|
||||
$budget = $this->program->getBudgetLeft($program);
|
||||
|
||||
if(dao::isError()) return array('message' => dao::getError());
|
||||
|
||||
return $budget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set tree path.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setTreePathTest($programID)
|
||||
{
|
||||
$this->program->setTreePath($programID);
|
||||
$program = $this->program->getByID($programID);
|
||||
|
||||
return $program;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get children.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getChildrenTest($programID)
|
||||
{
|
||||
return $this->program->getChildren($programID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check clickable.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param string $status
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function isClickableTest($programID, $status)
|
||||
{
|
||||
return $this->program->isClickable($programID, $status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Has unfinished.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function hasUnfinishedTest($programID)
|
||||
{
|
||||
$program = $this->program->getByID($programID);
|
||||
return $this->program->hasUnfinished($program);
|
||||
}
|
||||
|
||||
/*
|
||||
* get involved programs.
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getInvolvedProgramsTest($account)
|
||||
{
|
||||
return $this->program->getInvolvedPrograms($account);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get Tree menu.
|
||||
*
|
||||
* @param string $programID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTreeMenuTest($programID)
|
||||
{
|
||||
return $this->program->getTreeMenu($programID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get top pairs.
|
||||
*
|
||||
* @param string $model
|
||||
* @param string $mode
|
||||
* @param bool $isQueryAll
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTopPairsTest($model = '', $mode = '', $isQueryAll = false)
|
||||
{
|
||||
return $this->program->getTopPairs($model, $mode, $isQueryAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get kanban group.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getKanbanGroupTest()
|
||||
{
|
||||
return $this->program->getKanbanGroup();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get team member pairs .
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTeamMemberPairsTest($programID)
|
||||
{
|
||||
return $this->program->getTeamMemberPairs($programID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project stats.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param string $browseType
|
||||
* @param int $queryID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectStatsTest($programID = 0, $browseType = 'undone', $queryID = 0, $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
return $this->program->getProjectStats($programID, $browseType, $queryID, $orderBy, $pager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project list.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param string $browseType
|
||||
* @param int $queryID
|
||||
* @param string $orderBy
|
||||
* @param int $pager
|
||||
* @param int $programTitle
|
||||
* @param int $involved
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectListTest($programID = 0, $browseType = 'all', $queryID = 0, $orderBy = 'id_desc', $pager = null, $programTitle = 0, $involved = 0)
|
||||
{
|
||||
return $this->program->getProjectList($programID, $browseType, $queryID, $orderBy, $pager, $programTitle, $involved);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get progress list.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProgressListTest()
|
||||
{
|
||||
return $this->program->getProgressList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get stakeholders.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStakeholdersTest($programID, $orderBy = 'id_desc')
|
||||
{
|
||||
return $this->program->getStakeholders($programID, $orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test save state.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param array $programs
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function saveStateTest($programID = 0, $programs = array())
|
||||
{
|
||||
return $this->program->saveState($programID, $programs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test build operate menu.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function buildOperateMenuTest($programID = 0)
|
||||
{
|
||||
$program = $this->program->getByID($programID);
|
||||
if(empty($program)) return '0';
|
||||
|
||||
return $this->program->buildOperateMenu($program);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set menu.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function setMenuTest($programID = 0)
|
||||
{
|
||||
$program = $this->program->getByID($programID);
|
||||
if(empty($program)) return '0';
|
||||
|
||||
$this->program->setMenu($programID);
|
||||
|
||||
global $lang;
|
||||
return strip_tags($lang->switcherMenu);
|
||||
}
|
||||
}
|
||||
@@ -1,474 +0,0 @@
|
||||
<?php
|
||||
class programplanTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('programplan');
|
||||
$tester->dao->delete()->from(TABLE_PROJECTSPEC)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get plan by id.
|
||||
*
|
||||
* @param int $planID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIDTest($planID)
|
||||
{
|
||||
$object = $this->objectModel->getByID($planID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get plans list.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param int $productID
|
||||
* @param string $browseType
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getStageTest($executionID = 0, $productID = 0, $browseType = 'all', $orderBy = 'id_asc')
|
||||
{
|
||||
$objects = $this->objectModel->getStage($executionID, $productID, $browseType, $orderBy);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$title = '';
|
||||
foreach($objects as $object) $title .= ',' . $object->name;
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get plans by idList.
|
||||
*
|
||||
* @param array $idList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByListTest($idList = array())
|
||||
{
|
||||
$objects = $this->objectModel->getByList($idList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get plans.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param int $productID
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getPlansTest($executionID = 0, $productID = 0, $orderBy = 'id_asc')
|
||||
{
|
||||
$objects = $this->objectModel->getPlans($executionID, $productID, $orderBy);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$title = '';
|
||||
foreach($objects as $object) $title .= ',' . $object->name;
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get pairs.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param int $productID
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getPairsTest($executionID, $productID = 0, $type = 'all')
|
||||
{
|
||||
$objects = $this->objectModel->getPairs($executionID, $productID, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return implode(',', $objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get total percent.
|
||||
*
|
||||
* @param int $stageID
|
||||
* @param bool $parent
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getTotalPercentTest($stageID, $parent = false)
|
||||
{
|
||||
$stage = $this->objectModel->getByID($stageID);
|
||||
|
||||
$int = $this->objectModel->getTotalPercent($stage, $parent);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $int;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test process plans.
|
||||
*
|
||||
* @param array $planIDList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function processPlansTest($planIDList)
|
||||
{
|
||||
$plans = $this->objectModel->getByList($planIDList);
|
||||
|
||||
$objects = $this->objectModel->processPlans($plans);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test process plan.
|
||||
*
|
||||
* @param int $planID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function processPlanTest($planID)
|
||||
{
|
||||
$plan = $this->objectModel->getByID($planID);
|
||||
|
||||
$object = $this->objectModel->processPlan($plan);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get duration.
|
||||
*
|
||||
* @param date $begin
|
||||
* @param date $end
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getDurationTest($begin, $end)
|
||||
{
|
||||
$count = $this->objectModel->getDuration($begin, $end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a plan.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function createTest($param = array())
|
||||
{
|
||||
$_POST['planIDList'] = array('131', '221', '311', '401', '491', '581', '671');
|
||||
|
||||
global $tester;
|
||||
$plans = $tester->dao->select('*')->from(TABLE_PROJECT)->where('id')->in($_POST['planIDList'])->fetchAll();
|
||||
|
||||
|
||||
$_POST['names'] = array('阶段31', '阶段121', '阶段211', '阶段301', '阶段391', '阶段481', '阶段571', '', '', '', '', '');
|
||||
$_POST['PM'] = array('', '', '', '', '', '', '', '', '', '', '', '');
|
||||
$_POST['percents'] = array('0', '0', '0', '0', '0', '0', '0', '', '', '', '', '');
|
||||
$_POST['attributes'] = array('request', 'request', 'request', 'request', 'request', 'request', 'request', 'request', 'request', 'request', 'request', 'request');
|
||||
$_POST['acl'] = array('private', 'open', 'open', 'private', 'private', 'open', 'open', 'open', 'open', 'open', 'open', 'open');
|
||||
$_POST['milestone'] = array('0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
|
||||
$_POST['begin'] = (isset($param['begin']) and isset($param['end'])) ? array($plans[0]->begin, $plans[0]->begin, $plans[0]->begin, $plans[0]->begin, $plans[0]->begin, $plans[0]->begin, $plans[0]->begin, $plans[0]->begin, '', '', '', '') : array($plans[0]->begin, $plans[0]->begin, $plans[0]->begin, $plans[0]->begin, $plans[0]->begin, $plans[0]->begin, $plans[0]->begin, '', '', '', '', '');
|
||||
$_POST['end'] = (isset($param['begin']) and isset($param['end'])) ? array($plans[0]->end, $plans[0]->end, $plans[0]->end, $plans[0]->end, $plans[0]->end, $plans[0]->end, $plans[0]->end, $plans[0]->end, '', '', '', '') : array($plans[0]->end, $plans[0]->end, $plans[0]->end, $plans[0]->end, $plans[0]->end, $plans[0]->end, $plans[0]->end, '', '', '', '', '');
|
||||
$_POST['realBegan'] = array('', '', '', '', '', '', '', '', '', '', '', '');
|
||||
$_POST['realEnd'] = array('', '', '', '', '', '', '', '', '', '', '', '');
|
||||
|
||||
foreach($param as $field => $value)
|
||||
{
|
||||
if(count($param) == 1 or ($field != 'begin' and $field != 'end')) $_POST[$field] = $value;
|
||||
}
|
||||
|
||||
$objects = $this->objectModel->create(41, 0, 0);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError()['message'][0];
|
||||
$error = strpos($error, '所属项目的') > 0 ? preg_replace('/\d{4}-\d{2}-\d{2}/', '', $error) : $error;
|
||||
return $error;
|
||||
}
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_PROJECT)->where('parent')->eq($plans[0]->parent)->andWhere('type')->eq('stage')->fetchAll();
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set stage tree path.
|
||||
*
|
||||
* @param int $planID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function setTreePathTest($planID)
|
||||
{
|
||||
$this->objectModel->setTreePath($planID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByID($planID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* updateTest
|
||||
*
|
||||
* @param int $planID
|
||||
* @param int $projectID
|
||||
* @param array $param
|
||||
* @param string $index
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateTest($planID, $projectID, $param = array(), $index = '')
|
||||
{
|
||||
$plan = $this->objectModel->getByID($planID);
|
||||
|
||||
$_POST['parent'] = $plan->parent;
|
||||
$_POST['name'] = $plan->name;
|
||||
$_POST['percent'] = $plan->percent;
|
||||
$_POST['attribute'] = $plan->attribute;
|
||||
$_POST['milestone'] = $plan->milestone;
|
||||
$_POST['acl'] = $plan->acl;
|
||||
$_POST['begin'] = $plan->begin;
|
||||
$_POST['end'] = $plan->end;
|
||||
$_POST['realBegan'] = $plan->realBegan;
|
||||
$_POST['realEnd'] = $plan->realEnd;
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->update($planID, $projectID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return $index == 'end' ? preg_replace('/『\d{4}-\d{2}-\d{2}』/', '', dao::getError()[$index][0]) : dao::getError()[$index][0];
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test is create task.
|
||||
*
|
||||
* @param int $planID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function isCreateTaskTest($planID)
|
||||
{
|
||||
$object = $this->objectModel->isCreateTask($planID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object ? 2 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get the stage set to milestone.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getMilestonesTest($projectID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getMilestones($projectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return implode(',', $objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get milestone by product.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getMilestoneByProductTest($productID, $projectID)
|
||||
{
|
||||
$objects = $this->objectModel->getMilestoneByProduct($productID, $projectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return implode(',', $objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get parent stage list.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param int $planID
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getParentStageListTest($executionID, $planID, $productID)
|
||||
{
|
||||
$objects = $this->objectModel->getParentStageList($executionID, $planID, $productID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return implode(',', $objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get parent stage's children types.
|
||||
*
|
||||
* @param int $parentID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getParentChildrenTypesTest($parentID)
|
||||
{
|
||||
$objects = $this->objectModel->getParentChildrenTypes($parentID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check code unique.
|
||||
*
|
||||
* @param array $codes
|
||||
* @param array $planIDList
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function checkCodeUniqueTest($codes, $planIDList = array())
|
||||
{
|
||||
$objects = $this->objectModel->checkCodeUnique($codes, $planIDList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check name unique.
|
||||
*
|
||||
* @param array $names
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function checkNameUniqueTest($names)
|
||||
{
|
||||
$objects = $this->objectModel->checkNameUnique($names);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check if the stage is a leaf stage.
|
||||
*
|
||||
* @param int $planID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function checkLeafStageTest($planID)
|
||||
{
|
||||
$objects = $this->objectModel->checkLeafStage($planID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check whether it is the top stage.
|
||||
*
|
||||
* @param int $planID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function checkTopStageTest($planID)
|
||||
{
|
||||
$objects = $this->objectModel->checkTopStage($planID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update sub-stage attribute.
|
||||
*
|
||||
* @param int $planID
|
||||
* @param string $attribute
|
||||
* @param int $subStageID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function updateSubStageAttrTest($planID, $attribute, $subStageID)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$objects = $this->objectModel->updateSubStageAttr($planID, $attribute);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$attribute = $tester->dao->select('attribute')->from(TABLE_EXECUTION)->where('id')->eq($subStageID)->fetch('attribute');
|
||||
|
||||
return $attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get plan and its children.
|
||||
*
|
||||
* @param string|int|array $executionIdList
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSelfAndChildrenListTest($executionIdList)
|
||||
{
|
||||
$objects = $this->objectModel->getSelfAndChildrenList($executionIdList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get plan's siblings.
|
||||
*
|
||||
* @param string|int|array $executionIdList
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSiblingsTest($executionIdList)
|
||||
{
|
||||
$objects = $this->objectModel->getSiblings($executionIdList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
<?php
|
||||
class projectreleaseTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('projectrelease');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get release by id.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIDTest($releaseID)
|
||||
{
|
||||
$objects = $this->objectModel->getByID($releaseID);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error[0];
|
||||
}
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get list of releases.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getListTest($projectID, $type = 'all')
|
||||
{
|
||||
$objects = $this->objectModel->getList($projectID, $type);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error[0];
|
||||
}
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get last release.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getLastTest($projectID)
|
||||
{
|
||||
$objects = $this->objectModel->getLast($projectID);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error[0];
|
||||
}
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get released builds from project.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getReleasedBuildsTest($projectID)
|
||||
{
|
||||
$objects = $this->objectModel->getReleasedBuilds($projectID);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error[0];
|
||||
}
|
||||
if(count($objects) == 1)
|
||||
{
|
||||
return count($objects);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update a release.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @param string $name
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateTest($releaseID, $name = '', $date = '')
|
||||
{
|
||||
global $app;
|
||||
$app->loadConfig('release');
|
||||
|
||||
$updateFields['name'] = $name;
|
||||
$updateFields['build'] = 1;
|
||||
$updateFields['date'] = $date;
|
||||
$updateFields['status'] = 'normal';
|
||||
$updateFields['desc'] = '';
|
||||
$updateFields['labels'] = array();
|
||||
$updateFields['files'] = array();
|
||||
$updateFields['uid'] = '62450877d0a27';
|
||||
$updateFields['product'] = 1;
|
||||
foreach($updateFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
|
||||
$objects = $this->objectModel->update($releaseID);
|
||||
if($objects == array()) $objects = '没有数据更新';
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test link stories
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function linkStoryTest($releaseID)
|
||||
{
|
||||
$_POST['stories'] = array(1, 2);
|
||||
$this->objectModel->linkStory($releaseID);
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('stories')->from(TABLE_RELEASE)->where('id')->eq((int)$releaseID)->fetch();
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test unlink stories
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @param int $storyID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function unlinkStoryTest($releaseID, $storyID)
|
||||
{
|
||||
$this->linkStoryTest($releaseID);
|
||||
$this->objectModel->unlinkStory($releaseID, $storyID);
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('stories')->from(TABLE_RELEASE)->where('id')->eq((int)$releaseID)->fetch();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test link bugs.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function linkBugTest($releaseID, $type = 'bug')
|
||||
{
|
||||
$_POST['bugs'] = array(1, 2);
|
||||
$this->objectModel->linkBug($releaseID, $type);
|
||||
|
||||
global $tester;
|
||||
$field = $type == 'bug' ? 'bugs' : 'leftBugs';
|
||||
$objects = $tester->dao->select($field)->from(TABLE_RELEASE)->where('id')->eq((int)$releaseID)->fetch();
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
class projectstoryTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('projectstory');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set menu test
|
||||
*
|
||||
* @param array $products
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return xml
|
||||
*/
|
||||
public function setMenuTest($products = array(), $productID = 0, $branch = 0)
|
||||
{
|
||||
$objects = $this->objectModel->setMenu($products, $productID, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get execution stories test
|
||||
*
|
||||
* @param int mixed $projectID
|
||||
* @param array $storyIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getExecutionStoriesTest($projectID, $storyIdList = array())
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionStories($projectID, $storyIdList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,336 +0,0 @@
|
||||
<?php
|
||||
class releaseTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('release');
|
||||
}
|
||||
|
||||
/**
|
||||
* function getByIDTest by release
|
||||
*
|
||||
* @param string $releaseID
|
||||
* @param beel $setImgSize
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByIDTest($releaseID, $setImgSize = false)
|
||||
{
|
||||
$objects = $this->objectModel->getByID($releaseID, $setImgSize);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getListTest by release
|
||||
*
|
||||
* @param string $productID
|
||||
* @param string $branch
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function getListTest($productID, $branch = 'all', $type = 'all', $orderBy = 't1.date_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getList($productID, $branch, $type, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* function getLastTest by release
|
||||
*
|
||||
* @param string $productID
|
||||
* @param string $branch
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLastTest($productID, $branch = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getLast($productID, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get released test builds from product .
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string|int $branch
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getReleasedBuildsTest($productID, $branch = 'all')
|
||||
{
|
||||
$objects = $this->objectModel->getReleasedBuilds($productID, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a release.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function createTest($productID = 0, $branch = 0, $projectID = 0, $param = array())
|
||||
{
|
||||
|
||||
$date = date('Y-m-d');
|
||||
$labels = array();
|
||||
$files = array();
|
||||
$mailto = array();
|
||||
|
||||
$createFields = array('name' => '','marker' => '1', 'build' => '', 'date' => $date, 'desc' => '', 'mailto' => $mailto , 'labels' => $labels, 'files' => $files);
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectsID = $this->objectModel->create($productID, $branch, $projectID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($objectsID);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Update a release.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function updateTest($releaseID, $param = array())
|
||||
{
|
||||
$date = date('Y-m-d');
|
||||
$labels = array();
|
||||
$files = array();
|
||||
$mailto = array();
|
||||
|
||||
$createFields = array('name' => '','marker' => '1', 'build' => '', 'date' => $date, 'desc' => '', 'mailto' => $mailto , 'labels' => $labels, 'files' => $files);
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
$this->objectModel->update($releaseID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($releaseID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get notify persons.
|
||||
*
|
||||
* @param string $notfiyList
|
||||
* @param int $productID
|
||||
* @param int $buildID
|
||||
* @param int $releaseID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function getNotifyPersonsTest($releaseID)
|
||||
{
|
||||
$release = $this->objectModel->getById($releaseID);
|
||||
$objects = $this->objectModel->getNotifyPersons($release);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Link stories
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function linkStoryTest($releaseID, $stories)
|
||||
{
|
||||
$_POST['stories'] = $stories;
|
||||
$this->objectModel->linkStory($releaseID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($releaseID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlink story
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @param int $storyID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function unlinkStoryTest($releaseID, $storyID)
|
||||
{
|
||||
$_POST['stories'] = $storyID;
|
||||
$this->objectModel->linkStory($releaseID);
|
||||
unset($_POST);
|
||||
|
||||
$this->objectModel->unlinkStory($releaseID, $storyID[0]);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($releaseID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch unlink story.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function batchUnlinkStoryTest($releaseID, $stories)
|
||||
{
|
||||
$_POST['stories'] = $stories;
|
||||
$this->objectModel->linkStory($releaseID);
|
||||
unset($_POST);
|
||||
|
||||
$_POST['storyIdList'] = $stories;
|
||||
$this->objectModel->batchUnlinkStory($releaseID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($releaseID);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Link bugs.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @param string $type
|
||||
* @param string $bugs
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function linkBugTest($releaseID, $type = 'bug', $bugs = '')
|
||||
{
|
||||
$_POST['bugs'] = $bugs;
|
||||
$this->objectModel->linkBug($releaseID, $type);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($releaseID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlink bug.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @param int $bugID
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function unlinkBugTest($releaseID, $bugID, $type = 'bug')
|
||||
{
|
||||
$_POST['bugs'] = $bugID;
|
||||
$this->objectModel->linkBug($releaseID);
|
||||
unset($_POST);
|
||||
|
||||
$this->objectModel->unlinkBug($releaseID, $bugID[0], $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($releaseID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch unlink bug.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @param string $type
|
||||
* @param string $bugs
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchUnlinkBugTest($releaseID, $type = 'bug', $bugs = '')
|
||||
{
|
||||
$_POST['bugs'] = $bugs;
|
||||
$this->objectModel->linkBug($releaseID);
|
||||
unset($_POST);
|
||||
|
||||
$_POST['unlinkBugs'] = $bugs;
|
||||
$this->objectModel->batchUnlinkBug($releaseID, $type);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($releaseID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change status.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @param string $status
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
public function changeStatusTest($releaseID, $status)
|
||||
{
|
||||
$this->objectModel->changeStatus($releaseID, $status);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($releaseID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get toList and ccList.
|
||||
*
|
||||
* @param object $release
|
||||
* @access public
|
||||
* @return bool|array
|
||||
*/
|
||||
public function getToAndCcListTest($releaseID)
|
||||
{
|
||||
$release = $this->objectModel->getByID($releaseID);
|
||||
|
||||
$objects = $this->objectModel->getToAndCcList($release);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,559 +0,0 @@
|
||||
<?php
|
||||
class repoTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('repo');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check priv test.
|
||||
*
|
||||
* @param object $repo
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function checkPrivTest($repo)
|
||||
{
|
||||
$objects = $this->objectModel->checkPriv($repo);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function setMenuTest($repos, $repoID = '', $showSeleter = true)
|
||||
{
|
||||
$objects = $this->objectModel->setMenu($repos, $repoID, $showSeleter);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get switcher test.
|
||||
*
|
||||
* @param int $repoID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getSwitcherTest($repoID)
|
||||
{
|
||||
$objects = $this->objectModel->getSwitcher($repoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getListTest($projectID = 0, $SCM = '', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getList($projectID , $SCM, $orderBy , $pager );
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if(!empty($objects))
|
||||
{
|
||||
return $objects[1]->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'empty';
|
||||
}
|
||||
}
|
||||
|
||||
public function getListBySCMTest($scm, $type = 'all')
|
||||
{
|
||||
$objects = $this->objectModel->getListBySCM($scm, $type = 'all');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if(!empty($objects))
|
||||
{
|
||||
return $objects[0]->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'empty';
|
||||
}
|
||||
}
|
||||
|
||||
public function createTest($list)
|
||||
{
|
||||
$init = array('SCM' => '', 'serviceHost' => '', 'serviceProject' => '', 'name' => '', 'path' => '', 'encoding' => '', 'client' => '', 'account' => '', 'password' => '', 'encrypt' => '', 'desc' => '', 'uid' => '');
|
||||
|
||||
foreach($init as $filed => $defaultvalue) $_POST[$filed] = $defaultvalue;
|
||||
foreach($list as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->create();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function updateTest($id)
|
||||
{
|
||||
$objects = $this->objectModel->update($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function saveStateTest($repoID = 0, $objectID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->saveState($repoID, $objectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getRepoPairsTest($type, $projectID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getRepoPairs($type, $projectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getRepoGroupTest($type, $projectID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getRepoGroup($type, $projectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getRepoByIDTest($repoID)
|
||||
{
|
||||
$objects = $this->objectModel->getRepoByID($repoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getRepoByUrlTest($url)
|
||||
{
|
||||
$objects = $this->objectModel->getRepoByUrl($url);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getRepoListByUrlTest($url = '')
|
||||
{
|
||||
$objects = $this->objectModel->getRepoListByUrl($url = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getByIdListTest($idList)
|
||||
{
|
||||
$objects = $this->objectModel->getByIdList($idList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getBranchesTest($repo, $printLabel = false)
|
||||
{
|
||||
$objects = $this->objectModel->getBranches($repo, $printLabel);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getCommitsTest($repo, $entry, $revision = 'HEAD', $type = 'dir', $pager = null, $begin = 0, $end = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getCommits($repo, $entry, $revision, $type, $pager, $begin, $end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getLatestCommitTest($repoID)
|
||||
{
|
||||
$objects = $this->objectModel->getLatestCommit($repoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getRevisionsFromDBTest($repoID, $limit = '', $maxRevision = '', $minRevision = '')
|
||||
{
|
||||
$objects = $this->objectModel->getRevisionsFromDB($repoID, $limit = '', $maxRevision = '', $minRevision = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getHistoryTest($repoID, $revisions)
|
||||
{
|
||||
$objects = $this->objectModel->getHistory($repoID, $revisions);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return !empty($objects) ? array_keys($objects) : 'empty';
|
||||
}
|
||||
|
||||
public function getGitRevisionNameTest($revision, $commit)
|
||||
{
|
||||
$objects = $this->objectModel->getGitRevisionName($revision, $commit);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getCacheFileTest($repoID, $path, $revision)
|
||||
{
|
||||
$objects = $this->objectModel->getCacheFile($repoID, $path, $revision);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getProductsByRepoTest($repoID)
|
||||
{
|
||||
$objects = $this->objectModel->getProductsByRepo($repoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function saveCommitTest($repoID, $logs, $version, $branch = '')
|
||||
{
|
||||
$objects = $this->objectModel->saveCommit($repoID, $logs, $version, $branch = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function saveOneCommitTest($repoID, $commit, $version, $branch = '')
|
||||
{
|
||||
$objects = $this->objectModel->saveOneCommit($repoID, $commit, $version, $branch = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function saveExistCommits4BranchTest($repoID, $branch)
|
||||
{
|
||||
$objects = $this->objectModel->saveExistCommits4Branch($repoID, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function updateCommitCountTest($repoID, $count)
|
||||
{
|
||||
$objects = $this->objectModel->updateCommitCount($repoID, $count);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUnsyncedCommitsTest($repo)
|
||||
{
|
||||
$objects = $this->objectModel->getUnsyncedCommits($repo);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getPreAndNextTest($repo, $entry, $revision = 'HEAD', $fileType = 'dir', $method = 'view')
|
||||
{
|
||||
$objects = $this->objectModel->getPreAndNext($repo, $entry, $revision, $fileType, $method);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function createLinkTest($method, $params = '', $viewType = '', $onlybody = false)
|
||||
{
|
||||
$objects = $this->objectModel->createLink($method, $params, $viewType, $onlybody);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function setBackSessionTest($type = 'list', $withOtherModule = false)
|
||||
{
|
||||
$objects = $this->objectModel->setBackSession($type, $withOtherModule);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function setRepoBranchTest($branch)
|
||||
{
|
||||
$objects = $this->objectModel->setRepoBranch($branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function markSyncedTest($repoID)
|
||||
{
|
||||
$objects = $this->objectModel->markSynced($repoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function fixCommitTest($repoID)
|
||||
{
|
||||
$objects = $this->objectModel->fixCommit($repoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function encodePathTest($path = '')
|
||||
{
|
||||
$objects = $this->objectModel->encodePath($path);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function decodePathTest($path = '')
|
||||
{
|
||||
$objects = $this->objectModel->decodePath($path);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function isBinaryTest($content, $suffix = '')
|
||||
{
|
||||
$objects = $this->objectModel->isBinary($content, $suffix);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function checkClientTest()
|
||||
{
|
||||
$objects = $this->objectModel->checkClient();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function rmClientVersionFileTest()
|
||||
{
|
||||
$objects = $this->objectModel->rmClientVersionFile();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function checkConnectionTest()
|
||||
{
|
||||
$objects = $this->objectModel->checkConnection();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function replaceCommentLinkTest($comment)
|
||||
{
|
||||
$objects = $this->objectModel->replaceCommentLink($comment);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function addLinkTest($comment, $type)
|
||||
{
|
||||
$rules = $this->objectModel->processRules();
|
||||
$objectReg = '/' . $rules[$type . 'Reg'] . '/i';
|
||||
if(preg_match_all($objectReg, $comment, $result))
|
||||
{
|
||||
$links = $this->objectModel->addLink($result, $type);
|
||||
foreach($links as $link) return $link;
|
||||
}
|
||||
|
||||
return 'empty';
|
||||
}
|
||||
|
||||
public function parseCommentTest($comment)
|
||||
{
|
||||
$objects = $this->objectModel->parseComment($comment);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function iconvCommentTest($comment, $encodings)
|
||||
{
|
||||
$objects = $this->objectModel->iconvComment($comment, $encodings);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function processRulesTest()
|
||||
{
|
||||
$objects = $this->objectModel->processRules();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function saveAction2PMSTest($objects, $log, $repoRoot = '', $encodings = 'utf-8', $scm = 'svn', $gitlabAccountPairs = array())
|
||||
{
|
||||
$objects = $this->objectModel->saveAction2PMS($objects, $log, $repoRoot, $encodings, $scm, $gitlabAccountPairs);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function saveRecordTest($action, $changes)
|
||||
{
|
||||
$objects = $this->objectModel->saveRecord($action, $changes);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function createActionChangesTest($log, $repoRoot, $scm = 'svn')
|
||||
{
|
||||
$objects = $this->objectModel->createActionChanges($log, $repoRoot, $scm);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getTaskProductsAndExecutionsTest($tasks)
|
||||
{
|
||||
$objects = $this->objectModel->getTaskProductsAndExecutions($tasks);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getBugProductsAndExecutionsTest($bugs)
|
||||
{
|
||||
$objects = $this->objectModel->getBugProductsAndExecutions($bugs);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function buildURLTest($methodName, $url, $revision, $scm = 'svn')
|
||||
{
|
||||
$objects = $this->objectModel->buildURL($methodName, $url, $revision, $scm);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function processGitServiceTest($repo)
|
||||
{
|
||||
$objects = $this->objectModel->processGitService($repo);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getRepoListByClientTest($gitlabID, $projectID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getRepoListByClient($gitlabID, $projectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function handleWebhookTest($event, $token, $data, $repo)
|
||||
{
|
||||
$objects = $this->objectModel->handleWebhook($event, $token, $data, $repo);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getGitlabProductsByProjectsTest($projectIDs)
|
||||
{
|
||||
$objects = $this->objectModel->getGitlabProductsByProjects($projectIDs);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function syncCommitTest($repoID, $branchID)
|
||||
{
|
||||
$objects = $this->objectModel->syncCommit($repoID, $branchID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getExecutionPairsTest($product, $branch = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionPairs($product, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getCloneUrlTest($repo)
|
||||
{
|
||||
$objects = $this->objectModel->getCloneUrl($repo);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,542 +0,0 @@
|
||||
<?php
|
||||
class reportTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('report');
|
||||
$tester->dao->delete()->from(TABLE_ACTION)->where('id')->gt(100)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test compute percent of every item.
|
||||
*
|
||||
* @param array $datas
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function computePercentTest($datas)
|
||||
{
|
||||
$objects = $this->objectModel->computePercent($datas);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$percents = '';
|
||||
foreach($objects as $moduleID => $object) $percents .= "$moduleID:$object->percent;";
|
||||
return $percents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create json data of single charts.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createSingleJSONTest($executionID)
|
||||
{
|
||||
global $tester;
|
||||
$this->execution = $tester->loadModel('execution');
|
||||
|
||||
$execution = $this->execution->getByID($executionID);
|
||||
$sets = $this->execution->getBurnDataFlot($executionID, 'left');
|
||||
$dateList = $this->execution->getDateList($execution->begin, $execution->end, 'noweekend', 0, 'Y-m-d');
|
||||
|
||||
$objects = $this->objectModel->createSingleJSON($sets, $dateList[0]);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test convert date format.
|
||||
*
|
||||
* @param array $dateList
|
||||
* @param string $format
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function convertFormatTest($dateList, $format = 'Y-m-d')
|
||||
{
|
||||
$objects = $this->objectModel->convertFormat($dateList, $format = 'Y-m-d');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return implode(',', $objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get executions.
|
||||
*
|
||||
* @param int $begin
|
||||
* @param int $end
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionsTest($begin = 0, $end = 0)
|
||||
{
|
||||
global $tester;
|
||||
$tester->dao->update(TABLE_EXECUTION)->set('`status`')->eq('closed')->where('`id`')->in('101,102,103,107,111,121,151,183')->exec();
|
||||
|
||||
$begin = $begin != 0 ? date('Y-m-d', strtotime(date('Y-m-d') . $begin)) : 0;
|
||||
$end = $end != 0 ? date('Y-m-d', strtotime(date('Y-m-d') . $end)) : 0;
|
||||
$objects = $this->objectModel->getExecutions($begin, $end);
|
||||
|
||||
$tester->dao->update(TABLE_EXECUTION)->set('`status`')->eq('wait')->where('`id`')->in('101,103,107,111,121,151,183')->exec();
|
||||
$tester->dao->update(TABLE_EXECUTION)->set('`status`')->eq('doing')->where('`id`')->in('102')->exec();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$executions = '';
|
||||
foreach($objects as $executionID => $execution) $executions .= "$executionID:$execution->estimate,$execution->consumed,$execution->projectName;";
|
||||
return $executions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get products.
|
||||
*
|
||||
* @param string $conditions
|
||||
* @param string $storyType
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProductsTest($conditions, $storyType = 'story')
|
||||
{
|
||||
$objects = $this->objectModel->getProducts($conditions, $storyType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$planCount = 0;
|
||||
foreach($objects as $object)
|
||||
{
|
||||
if(isset($object->plans)) $planCount += count($object->plans);
|
||||
}
|
||||
return 'product:' . count($objects) . ';plan:' . $planCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get bugs.
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @param int $product
|
||||
* @param int $execution
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBugsTest($begin, $end, $product, $execution)
|
||||
{
|
||||
$begin = date('Y-m-d', strtotime(date('Y-m-d') . $begin));
|
||||
$end = date('Y-m-d', strtotime(date('Y-m-d') . $end));
|
||||
$objects = $this->objectModel->getBugs($begin, $end, $product, $execution);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$count = array();
|
||||
foreach($objects as $user => $types)
|
||||
{
|
||||
$count[$user] = '';
|
||||
foreach($types as $type => $typeCount) $count[$user] .= "$type:$typeCount;";
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get workload.
|
||||
*
|
||||
* @param int $dept
|
||||
* @param string $assign
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getWorkloadTest($dept = 0, $assign = 'assign')
|
||||
{
|
||||
$objects = $this->objectModel->getWorkload($dept, $assign);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$workload = '';
|
||||
foreach($objects as $user => $work)
|
||||
{
|
||||
if(strlen($workload) > 40) break;
|
||||
|
||||
$workload .= "$user:";
|
||||
foreach($work['total'] as $key => $value) $workload .= "$key:$value,";
|
||||
$workload = trim($workload, ',');
|
||||
$workload .= ';';
|
||||
}
|
||||
return $workload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get bug assign.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getBugAssignTest()
|
||||
{
|
||||
$objects = $this->objectModel->getBugAssign();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$count = array();
|
||||
foreach($objects as $user => $object) $count[$user] = $object['total']['count'];
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get user bugs.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getUserBugsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getUserBugs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$counts = '';
|
||||
foreach($objects as $user => $bugs) $counts .= "$user:" . count($bugs) . ';';
|
||||
return $counts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get user tasks.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getUserTasksTest()
|
||||
{
|
||||
$objects = $this->objectModel->getUserTasks();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$counts = '';
|
||||
foreach($objects as $user => $tasks) $counts .= "$user:" . count($tasks) . ';';
|
||||
return $counts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get user todos.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getUserTodosTest($userType)
|
||||
{
|
||||
$objects = $this->objectModel->getUserTodos();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$counts = '';
|
||||
foreach($objects as $user => $todos)
|
||||
{
|
||||
if(strpos($user, $userType) !== false and str_replace($userType, '', $user) < 11) $counts .= "$user:" . count($todos) . ';';
|
||||
}
|
||||
return $counts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get user test tasks.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getUserTestTasksTest()
|
||||
{
|
||||
$objects = $this->objectModel->getUserTestTasks();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$counts = '';
|
||||
foreach($objects as $user => $testtasks) $counts .= "$user:" . count($testtasks) . ';';
|
||||
return $counts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get user login count in this year.
|
||||
*
|
||||
* @param string $accounts
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getUserYearLoginsTest($accounts)
|
||||
{
|
||||
$year = date('Y');
|
||||
|
||||
$objects = $this->objectModel->getUserYearLogins($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get user action count in this year.
|
||||
*
|
||||
* @param array $accounts
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getUserYearActionsTest($accounts)
|
||||
{
|
||||
$year = date('Y');
|
||||
|
||||
$objects = $this->objectModel->getUserYearActions($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get user contributions in this year.
|
||||
*
|
||||
* @param array $accounts
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getUserYearContributionsTest($accounts)
|
||||
{
|
||||
$year = date('Y');
|
||||
|
||||
$objects = $this->objectModel->getUserYearContributions($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$contributions = '';
|
||||
foreach($objects as $type => $contributionTypes)
|
||||
{
|
||||
$contributions .= "$type:";
|
||||
foreach($contributionTypes as $contributionType => $count) $contributions .= "$contributionType:$count,";
|
||||
$contributions = trim($contributions, ',') . ';';
|
||||
}
|
||||
return $contributions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get user todo stat in this year.
|
||||
*
|
||||
* @param array $accounts
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getUserYearTodosTest($accounts)
|
||||
{
|
||||
$year = date('Y');
|
||||
$objects = $this->objectModel->getUserYearTodos($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$count = '';
|
||||
foreach($objects as $type => $value) $count .= "$type:$value;";
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get user effort stat in this error.
|
||||
*
|
||||
* @param string $accounts
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getUserYearEffortsTest($accounts)
|
||||
{
|
||||
$year = date('Y');
|
||||
|
||||
$object = $this->objectModel->getUserYearEfforts($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get count of created story,plan and closed story by accounts every product in this year.
|
||||
*
|
||||
* @param mixed $accounts
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getUserYearProductsTest($accounts)
|
||||
{
|
||||
$year = date('Y');
|
||||
|
||||
$objects = $this->objectModel->getUserYearProducts($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return implode(',', array_keys($objects));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get count of finished task, story and resolved bug by accounts every executions in this years.
|
||||
*
|
||||
* @param string $accounts
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getUserYearExecutionsTest($accounts)
|
||||
{
|
||||
$year = date('Y');
|
||||
|
||||
$objects = $this->objectModel->getUserYearExecutions($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return implode(',', array_keys($objects));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get status stat that is all time, include story, task and bug.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getAllTimeStatusStatTest()
|
||||
{
|
||||
$objects = $this->objectModel->getAllTimeStatusStat();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$types = array();
|
||||
foreach($objects as $type => $status)
|
||||
{
|
||||
$types[$type] = '';
|
||||
foreach($status as $statusType => $statusCount) $types[$type] .= "$statusType:$statusCount;";
|
||||
}
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get year object stat, include status and action stat.
|
||||
*
|
||||
* @param string $accounts
|
||||
* @param string $objectType
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getYearObjectStatTest($accounts, $objectType)
|
||||
{
|
||||
$year = date('Y');
|
||||
|
||||
$objects = $this->objectModel->getYearObjectStat($accounts, $year, $objectType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$stats = '';
|
||||
foreach($objects['statusStat'] as $stat => $count) $stats .= "$stat:$count;";
|
||||
return $stats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get year case stat, include result and action stat.
|
||||
*
|
||||
* @param string $accounts
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getYearCaseStatTest($accounts)
|
||||
{
|
||||
$year = date('Y');
|
||||
|
||||
$objects = $this->objectModel->getYearCaseStat($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$result = '';
|
||||
foreach($objects['resultStat'] as $type => $value) $result .= "$type:$value;";
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get year months.
|
||||
*
|
||||
* @param string $year
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getYearMonthsTest($year)
|
||||
{
|
||||
$objects = $this->objectModel->getYearMonths($year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return implode(',', $objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get status overview.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param array $statusStat
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getStatusOverviewTest($objectType, $statusStat)
|
||||
{
|
||||
$object = $this->objectModel->getStatusOverview($objectType, $statusStat);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get project status overview.
|
||||
*
|
||||
* @param array $accounts
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectStatusOverviewTest($accounts = array())
|
||||
{
|
||||
$objects = $this->objectModel->getProjectStatusOverview($accounts);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$counts = '';
|
||||
foreach($objects as $type => $count) $counts .= "$type:$count;";
|
||||
return $counts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get output data for API.
|
||||
*
|
||||
* @param string $accounts
|
||||
* @param string $year
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getOutput4APITest($accounts)
|
||||
{
|
||||
$year = date('Y');
|
||||
$objects = $this->objectModel->getOutput4API($accounts, $year);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$output = '';
|
||||
foreach($objects as $objectType => $object) $output .= "$objectType:" . $object['total'] . ";";
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get project and execution name.
|
||||
*
|
||||
* @param bool $count
|
||||
* @access public
|
||||
* @return int|array
|
||||
*/
|
||||
public function getProjectExecutionsTest($count = false)
|
||||
{
|
||||
$objects = $this->objectModel->getProjectExecutions();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $count ? count($objects) : $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
class scoreTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('score');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user score list.
|
||||
*
|
||||
* @param string $account
|
||||
* @param object $pager
|
||||
* @param bool $needCount
|
||||
*
|
||||
* @access public
|
||||
* @return array|int
|
||||
*/
|
||||
public function getListByAccountTest($account, $pager, $needCount = false)
|
||||
{
|
||||
$objects = $this->objectModel->getListByAccount($account, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $needCount ? count($objects) : $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add score logs.
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $method
|
||||
* @param string $param
|
||||
* @param string $account
|
||||
* @param string $time
|
||||
*
|
||||
* @access public
|
||||
* @return string|object
|
||||
*/
|
||||
public function createTest($module = '', $method = '', $param = '', $account = '', $time = '')
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$object = $this->objectModel->create($module, $method, $param, $account, $time);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$object = (!empty((array) $object) and is_object($object)) ? $object : '';
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Score reset.
|
||||
*
|
||||
* @param int $lastID
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function resetTest($lastID = 0)
|
||||
{
|
||||
$result = $this->objectModel->reset($lastID);
|
||||
while($result['status'] != 'finish')
|
||||
{
|
||||
$result = $this->objectModel->reset($result['lastID']);
|
||||
}
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix action type for score.
|
||||
*
|
||||
* @param $string
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function fixKeyTest($string)
|
||||
{
|
||||
$objects = $this->objectModel->fixKey($string);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,281 +0,0 @@
|
||||
<?php
|
||||
class searchTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('search');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get query.
|
||||
*
|
||||
* @param int $queryID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getQueryTest($queryID)
|
||||
{
|
||||
$objects = $this->objectModel->getQuery($queryID);
|
||||
|
||||
global $tester;
|
||||
$objectType = $objects->module;
|
||||
if($objects->module == 'executionStory') $objectType = 'story';
|
||||
if($objects->module == 'projectBuild') $objectType = 'build';
|
||||
if($objects->module == 'executionBuild') $objectType = 'build';
|
||||
|
||||
$table = $tester->config->objectTables[$objectType];
|
||||
$objects->queryCount = $tester->dao->select('count(*) as count')->from($table)->where($objects->sql)->fetch('count');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get by ID.
|
||||
*
|
||||
* @param int $queryID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByIDTest($queryID)
|
||||
{
|
||||
$objects = $this->objectModel->getByID($queryID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete query.
|
||||
*
|
||||
* @param int $queryID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function deleteQueryTest($queryID)
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel->deleteQuery($queryID);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$count = $tester->dao->select('count(*) as count')->from(TABLE_USERQUERY)->fetch('count');
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get query pairs.
|
||||
*
|
||||
* @param string $module
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getQueryPairsTest($module)
|
||||
{
|
||||
$objects = $this->objectModel->getQueryPairs($module);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get list.
|
||||
*
|
||||
* @param string $keywords
|
||||
* @param sreing $type
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getListTest($keywords, $type)
|
||||
{
|
||||
$result = array();
|
||||
while(!isset($result['finished']))
|
||||
{
|
||||
if(empty($result))
|
||||
{
|
||||
$result = $this->objectModel->buildAllIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->objectModel->buildAllIndex($result['type'], $result['lastID']);
|
||||
}
|
||||
}
|
||||
|
||||
$objects = $this->objectModel->getList($keywords, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$tester->dao->delete()->from(TABLE_SEARCHINDEX)->exec();
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test save index.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function saveIndexTest($objectType, $objectID)
|
||||
{
|
||||
global $tester;
|
||||
$tester->dao->delete()->from(TABLE_SEARCHINDEX)->exec();
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
|
||||
$table = $tester->config->objectTables[$objectType];
|
||||
$object = $tester->dao->select('*')->from($table)->where('id')->eq($objectID)->fetch();
|
||||
$object->comment = '';
|
||||
|
||||
$objects = $this->objectModel->saveIndex($objectType, $object);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$insertedIndex = $tester->dao->select('*')->from(TABLE_SEARCHINDEX)->where('objectType')->eq($objectType)->andWhere('objectID')->eq($objectID)->fetch();
|
||||
|
||||
$tester->dao->delete()->from(TABLE_SEARCHINDEX)->exec();
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
|
||||
if($insertedIndex) return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test save dict.
|
||||
*
|
||||
* @param string $word
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function saveDictTest($word)
|
||||
{
|
||||
global $tester;
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
|
||||
$spliter = $tester->app->loadClass('spliter');
|
||||
$titleSplited = $spliter->utf8Split($word);
|
||||
|
||||
$objects = $this->objectModel->saveDict($titleSplited['dict']);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$count = $tester->dao->select("count('*') as count")->from(TABLE_SEARCHDICT)->fetch('count');
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test decode.
|
||||
*
|
||||
* @param int $key
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function decodeTest($key)
|
||||
{
|
||||
global $tester;
|
||||
$tester->dao->delete()->from(TABLE_SEARCHINDEX)->exec();
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
|
||||
$result = array();
|
||||
while(!isset($result['finished']))
|
||||
{
|
||||
if(empty($result))
|
||||
{
|
||||
$result = $this->objectModel->buildAllIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->objectModel->buildAllIndex($result['type'], $result['lastID']);
|
||||
}
|
||||
}
|
||||
|
||||
$objects = $this->objectModel->decode($key);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$tester->dao->delete()->from(TABLE_SEARCHINDEX)->exec();
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get summary.
|
||||
*
|
||||
* @param int $indexID
|
||||
* @param string $words
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getSummaryTest($indexID, $words)
|
||||
{
|
||||
global $tester;
|
||||
$tester->dao->delete()->from(TABLE_SEARCHINDEX)->exec();
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
|
||||
$result = array();
|
||||
while(!isset($result['finished']))
|
||||
{
|
||||
if(empty($result))
|
||||
{
|
||||
$result = $this->objectModel->buildAllIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->objectModel->buildAllIndex($result['type'], $result['lastID']);
|
||||
}
|
||||
}
|
||||
|
||||
$searchIndex = $tester->dao->select('*')->from(TABLE_SEARCHINDEX)->where('id')->eq($indexID)->fetch();
|
||||
|
||||
$objects = $this->objectModel->getSummary($searchIndex->content, $words);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$tester->dao->delete()->from(TABLE_SEARCHINDEX)->exec();
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test mark keywords.
|
||||
*
|
||||
* @param int $indexID
|
||||
* @param string $keywords
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function markKeywordsTest($indexID, $keywords)
|
||||
{
|
||||
global $tester;
|
||||
$tester->dao->delete()->from(TABLE_SEARCHINDEX)->exec();
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
|
||||
$result = array();
|
||||
while(!isset($result['finished']))
|
||||
{
|
||||
if(empty($result))
|
||||
{
|
||||
$result = $this->objectModel->buildAllIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->objectModel->buildAllIndex($result['type'], $result['lastID']);
|
||||
}
|
||||
}
|
||||
|
||||
$searchIndex = $tester->dao->select('*')->from(TABLE_SEARCHINDEX)->where('id')->eq($indexID)->fetch();
|
||||
|
||||
$objects = $this->objectModel->markKeywords($searchIndex->content, $keywords);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$tester->dao->delete()->from(TABLE_SEARCHINDEX)->exec();
|
||||
$tester->dao->delete()->from(TABLE_SEARCHDICT)->exec();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,273 +0,0 @@
|
||||
<?php
|
||||
class settingTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('setting');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value of an item.
|
||||
*
|
||||
* @param string $paramString see parseItemParam();
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function getItemTest($paramString)
|
||||
{
|
||||
$objects = $this->objectModel->getItem($paramString);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($objects or $objects === 0 or $objects === '0') return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get some items.
|
||||
*
|
||||
* @param string $paramString see parseItemParam();
|
||||
* @access public
|
||||
* @return array|string
|
||||
*/
|
||||
public function getItemsTest($paramString)
|
||||
{
|
||||
$objects = $this->objectModel->getItems($paramString);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value of an item.
|
||||
*
|
||||
* @param string $path system.common.global.sn | system.common.sn | system.common.global.sn@rnd
|
||||
* @param string $value
|
||||
* @access public
|
||||
* @return misc
|
||||
*/
|
||||
public function setItemTest($path, $value = '')
|
||||
{
|
||||
$this->objectModel->setItem($path, $value);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
/* Determine vision of config item. */
|
||||
$pathVision = explode('@', $path);
|
||||
$vision = isset($pathVision[1]) ? $pathVision[1] : '';
|
||||
$path = $pathVision[0];
|
||||
$level = substr_count($path, '.');
|
||||
$section = '';
|
||||
|
||||
if($level <= 1) return false;
|
||||
if($level == 2) list($owner, $module, $key) = explode('.', $path);
|
||||
if($level == 3) list($owner, $module, $section, $key) = explode('.', $path);
|
||||
$paramString = "vision=$vision&owner=$owner&module=$module§ion=$section&key=$key";
|
||||
$objects = $this->objectModel->getItem($paramString);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch set items, the example:
|
||||
*
|
||||
* $path = 'system.mail';
|
||||
* $items->turnon = true;
|
||||
* $items->smtp->host = 'localhost';
|
||||
*
|
||||
* @param string $path like system.mail
|
||||
* @param array|object $items the items array or object, can be mixed by one level or two levels.
|
||||
* @access public
|
||||
* @return bool|string
|
||||
*/
|
||||
public function setItemsTest($path, $items)
|
||||
{
|
||||
$result = $this->objectModel->setItems($path, $items);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete items.
|
||||
*
|
||||
* @param string $paramString see parseItemParam();
|
||||
* @access public
|
||||
* @return misc
|
||||
*/
|
||||
public function deleteItemsTest($paramString)
|
||||
{
|
||||
$this->objectModel->deleteItems($paramString);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->getItemTest($paramString);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse item path test.
|
||||
*
|
||||
* @param string $path
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function parseItemPathTest($path)
|
||||
{
|
||||
$object = $this->objectModel->parseItemPath($path);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the param string for select or delete items.
|
||||
*
|
||||
* @param string $paramString owner=xxx&key=sn and so on.
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function parseItemParamTest($paramString)
|
||||
{
|
||||
$objects = $this->objectModel->parseItemParam($paramString);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a DAO object to select or delete one or more records.
|
||||
*
|
||||
* @param string $paramString
|
||||
* @param string $method select|delete.
|
||||
* @access public
|
||||
* @return array|int
|
||||
*/
|
||||
public function createDAOTest($paramString, $method = 'select')
|
||||
{
|
||||
$params = $this->objectModel->parseItemParam($paramString);
|
||||
if($method == 'delete')
|
||||
{
|
||||
$objects = $this->objectModel->createDAO($params, $method)->exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
$objects = $this->objectModel->createDAO($params, $method)->orderBy('key')->fetch();
|
||||
}
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get config of system and one user.
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function getSysAndPersonalConfigTest($account = '')
|
||||
{
|
||||
$objects = $this->objectModel->getSysAndPersonalConfig($account);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return !empty($objects) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get the version of current zentaopms.
|
||||
*
|
||||
* Since the version field not saved in db. So if empty, return 0.3 beta.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getVersionTest()
|
||||
{
|
||||
$objects = $this->objectModel->getVersion();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get URSR.
|
||||
*
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getURSRTest()
|
||||
{
|
||||
$objects = $this->objectModel->getURSR();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update version
|
||||
*
|
||||
* @param string $version
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateVersionTest($version)
|
||||
{
|
||||
$this->objectModel->updateVersion($version);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$params['owner'] = 'system';
|
||||
$params['module'] = 'common';
|
||||
$params['section'] = 'global';
|
||||
$params['key'] = 'version';
|
||||
|
||||
$objects = $this->objectModel->createDAO($params)->fetchAll();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test set the sn of current zentaopms.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function setSNTest()
|
||||
{
|
||||
$this->objectModel->setSN();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$params['owner'] = 'system';
|
||||
$params['module'] = 'common';
|
||||
$params['section'] = 'global';
|
||||
$params['key'] = 'sn';
|
||||
|
||||
$objects = $this->objectModel->createDAO($params)->fetchAll();
|
||||
|
||||
return !empty($objects) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test judge a sn needed update or not.
|
||||
*
|
||||
* @param string $sn
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function snNeededUpdateTest($sn)
|
||||
{
|
||||
$objects = $this->objectModel->snNeededUpdate($sn);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
class sonarqubeTest
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('sonarqube');
|
||||
}
|
||||
|
||||
public function apiCreateProjectTest($sonarqubeID, $project = array())
|
||||
{
|
||||
$result = $this->objectModel->apiCreateProject($sonarqubeID, (object)$project);
|
||||
|
||||
if($result === false) $result = 'return false';
|
||||
if(isset($result->errors)) $result = $result->errors;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function createProjectTest($sonarqubeID, $post)
|
||||
{
|
||||
$_POST['projectName'] = $post['projectName'];
|
||||
$_POST['projectKey'] = $post['projectKey'];
|
||||
|
||||
$result = $this->objectModel->createProject($sonarqubeID);
|
||||
$errors = dao::getError();
|
||||
if($errors)
|
||||
{
|
||||
if(current($errors) == "项目标识的格式不正确。允许的字符为字母、数字、'-'、''、'.'和“:”,至少有一个非数字。") return 'return error';
|
||||
if(current($errors) == false) return 'return false';
|
||||
return $errors;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(empty($result)) $result = 'return false';
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
public function apiDeleteProjectTest($sonarqubeID, $projectKey)
|
||||
{
|
||||
$result = $this->objectModel->apiDeleteProject($sonarqubeID, $projectKey);
|
||||
|
||||
if($result === false) $result = 'return false';
|
||||
if($result === null) $result = 'return true';
|
||||
if(isset($result->errors)) $result = $result->errors;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function apiGetIssuesTest($sonarqubeID, $projectKey = '')
|
||||
{
|
||||
$result = $this->objectModel->apiGetIssues($sonarqubeID, $projectKey);
|
||||
|
||||
if(empty($result)) $result = 'return empty';
|
||||
if(isset($result[0]->message)) $result = true;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function apiGetProjectsTest($sonarqubeID, $keyword = '')
|
||||
{
|
||||
$result = $this->objectModel->apiGetProjects($sonarqubeID, $keyword);
|
||||
|
||||
if(empty($result)) $result = 'return empty';
|
||||
if($keyword == '' and isset($result[0]->name)) $result = true;
|
||||
if($keyword != '' and strpos($result[0]->name, $keyword) !== false) $result = true;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function apiValidateTest($sonarqubeID, $url = '', $token = '')
|
||||
{
|
||||
global $tester;
|
||||
$sonarqubeServer = $tester->loadModel('pipeline')->getByID($sonarqubeID);
|
||||
$url = $url ? $url : $sonarqubeServer->url;
|
||||
$token = $token ? $token : $sonarqubeServer->token;
|
||||
|
||||
$result = $this->objectModel->apiValidate($url, $token);
|
||||
|
||||
if(empty($result)) $result = 'success';
|
||||
if(isset($result['password'])) $result = 'return false';
|
||||
if(isset($result['account'])) $result = 'return false';
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getApiBaseTest($sonarqubeID)
|
||||
{
|
||||
list($apiRoot, $header) = $this->objectModel->getApiBase($sonarqubeID);
|
||||
|
||||
if(empty($apiRoot)) return 'return empty';
|
||||
return $apiRoot;
|
||||
}
|
||||
|
||||
public function getCacheFile($sonarqubeID, $projectKey)
|
||||
{
|
||||
$result = $this->objectModel->getCacheFile($sonarqubeID, $projectKey);
|
||||
|
||||
if(strPos($result, '/' . $sonarqubeID . '-' ) !== false) return true;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
class ssoTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('sso');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a user.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createTest($param = array())
|
||||
{
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$result = $this->objectModel->createUser();
|
||||
|
||||
unset($_POST);
|
||||
if($result['status'] == 'fail') return 'fail';
|
||||
|
||||
$object = $this->objectModel->getBindUser($param['account']);
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
<?php
|
||||
class stageTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('stage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a stage.
|
||||
*
|
||||
* @param object $stage
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createTest($stage, $type = 'waterfall')
|
||||
{
|
||||
foreach($stage as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectID = $this->objectModel->create($type);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByID($objectID, $type);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch create stages.
|
||||
*
|
||||
* @param array $param
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function batchCreateTest($param ,$type = 'waterfall')
|
||||
{
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->batchCreate($type);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getStages('id_desc', 0, $type);
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update a stage.
|
||||
*
|
||||
* @param int $stageID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateTest($stageID, $param)
|
||||
{
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->update($stageID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get stages.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStagesTest($orderBy = 'id_desc')
|
||||
{
|
||||
$objects = $this->objectModel->getStages($orderBy = 'id_desc');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get pairs of stage.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get a stage by id.
|
||||
*
|
||||
* @param int $stageID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIDTest($stageID)
|
||||
{
|
||||
$object = $this->objectModel->getByID($stageID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get a stage by id.
|
||||
*
|
||||
* @param string $projectType
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getTotalPercentTest($projectType)
|
||||
{
|
||||
$object = $this->objectModel->getTotalPercent($projectType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
<?php
|
||||
class stakeholderTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('stakeholder');
|
||||
}
|
||||
|
||||
/**
|
||||
* Function create test by stakeholder
|
||||
*
|
||||
* @param int $objectID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function createTest($objectID, $param = array())
|
||||
{
|
||||
$createFields = array('from' => '', 'key' => '', 'user' => '', 'name' => '', 'phone' => '', 'qq' => '', 'weixin' => '',
|
||||
'email' => '', 'company' => '', 'nature' => '', 'analysis' => '', 'strategy' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectID = $this->objectModel->create($objectID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($objectID);
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function batchCreate test by stakeholder
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchCreateTest($projectID, $param = array())
|
||||
{
|
||||
$realnames = array();
|
||||
$accounts = array();
|
||||
|
||||
$createFields = array('realnames' => $realnames, 'accounts' => $accounts);
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->batchCreate($projectID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function edit test by stakeholder
|
||||
*
|
||||
* @param int $stakeholderID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function editTest($stakeholderID, $param = array())
|
||||
{
|
||||
$createFields = array('key' => '', 'nature' => '', 'analysis' => '', 'strategy' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->edit($stakeholderID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function communicate test by stakeholder
|
||||
*
|
||||
* @param int $stakeholderID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function communicateTest($stakeholderID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
$createFields = array('comment' => '');
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->communicate($stakeholderID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_ACTION)->where('objectID')->eq($stakeholderID)->andwhere('objectType')->eq('stakeholder')->fetchAll();
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,530 +0,0 @@
|
||||
<?php
|
||||
class storyTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('story');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get by id.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param int $version
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getByIdTest($storyID, $version = 0)
|
||||
{
|
||||
$story = $this->objectModel->getById($storyID, $version);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $story;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get by list.
|
||||
*
|
||||
* @param int $storyIdList
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getByListTest($storyIdList = 0, $type = 'story')
|
||||
{
|
||||
$stories = $this->objectModel->getByList($storyIdList, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $stories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get test stories.
|
||||
*
|
||||
* @param array $storyIdList
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTestStoriesTest($storyIdList, $executionID)
|
||||
{
|
||||
$objects = $this->objectModel->getTestStories($storyIdList, $executionID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get story specs.
|
||||
*
|
||||
* @param array $storyIdList
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getStorySpecsTest($storyIdList)
|
||||
{
|
||||
$objects = $this->objectModel->getStorySpecs($storyIdList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get affected scope.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getAffectedScopeTest($storyID)
|
||||
{
|
||||
global $tester;
|
||||
$story = $tester->loadModel('story')->getById($storyID);
|
||||
$scope = $this->objectModel->getAffectedScope($story);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get requierements.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getRequierementsTest($productID)
|
||||
{
|
||||
$requirements = $this->objectModel->getRequierements($productID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create story.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param int $bugID
|
||||
* @param string $from
|
||||
* @param string $extra
|
||||
* @param string $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createTest($executionID = 0, $bugID = 0, $from = '', $extra = '', $params = '')
|
||||
{
|
||||
$_POST = $params;
|
||||
$result = $this->objectModel->create($executionID, $bugID, $from, $extra);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$storyID = $result['id'];
|
||||
return $tester->loadModel('story')->getById($storyID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create story from gitlab issue.
|
||||
*
|
||||
* @param int $story
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createStoryFromGitlabIssueTest($story, $executionID)
|
||||
{
|
||||
$storyID = $this->objectModel->createStoryFromGitlabIssue($story, $executionID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
return $tester->loadModel('story')->getById($storyID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch create stories.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param string $type
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchCreateTest($productID = 0, $branch = 0, $type = 'story', $params = '')
|
||||
{
|
||||
$_POST = $params;
|
||||
$results = $this->objectModel->batchCreate($productID, $branch, $type);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
foreach($results as $result) $storyIdList[] = $result->storyID;
|
||||
|
||||
global $tester;
|
||||
$stories = $tester->loadModel('story')->getByList($storyIdList);
|
||||
return $stories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test change story.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function changeTest($storyID, $params)
|
||||
{
|
||||
$_POST = $params;
|
||||
$this->objectModel->change($storyID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
return $tester->loadModel('story')->getById($storyID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update story.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updateTest($storyID, $params)
|
||||
{
|
||||
$_POST = $params;
|
||||
$this->objectModel->update($storyID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $this->objectModel->getById($storyID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update story order of plan.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param string $planIDList
|
||||
* @param string $oldPlanIDList
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updateStoryOrderOfPlanTest($storyID, $planIDList = '', $oldPlanIDList = '')
|
||||
{
|
||||
$this->objectModel->updateStoryOrderOfPlan($storyID, $planIDList, $oldPlanIDList);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
return $tester->dao->select('*')->from(TABLE_PLANSTORY)->where('plan')->in($planIDList)->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test compute estimate.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function computeEstimateTest($storyID)
|
||||
{
|
||||
$this->objectModel->computeEstimate($storyID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $this->objectModel->getByID($storyID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch update stories.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchUpdateTest($params)
|
||||
{
|
||||
$_POST = $params;
|
||||
$allStories = $this->objectModel->batchUpdate();
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$storyIdList = array_keys($allStories);
|
||||
return $this->objectModel->getByList($storyIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test review story.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function reviewTest($storyID, $params)
|
||||
{
|
||||
$_POST = $params;
|
||||
$changes = $this->objectModel->review($storyID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $this->objectModel->getByID($storyID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch review.
|
||||
*
|
||||
* @param int $storyIdList
|
||||
* @param int $result
|
||||
* @param int $reason
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchReviewTest($storyIdList, $result, $reason)
|
||||
{
|
||||
$actions = $this->objectModel->batchReview($storyIdList, $result, $reason);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$storyIdList = array_keys($actions);
|
||||
return $this->objectModel->getByList($storyIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test story subdivide.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param array $stories
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function subdivideTest($storyID, $stories, $type)
|
||||
{
|
||||
$this->objectModel->subdivide($storyID, $stories);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
if($type == 'requirement')
|
||||
{
|
||||
return $tester->dao->select('*')->from(TABLE_RELATION)->where('AID')->eq($storyID)->andWhere('AType')->eq($type)->fetchAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->objectModel->getById($storyID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test close a story.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function closeTest($storyID, $params)
|
||||
{
|
||||
$_POST = $params;
|
||||
$changes = $this->objectModel->close($storyID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch close story.
|
||||
*
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchCloseTest($params)
|
||||
{
|
||||
$_POST = $params;
|
||||
$changes = $this->objectModel->batchClose();
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$storyIdList = array_keys($changes);
|
||||
return $this->objectModel->getByList($storyIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch change story module.
|
||||
*
|
||||
* @param int $storyIdList
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchChangeModuleTest($storyIdList, $moduleID)
|
||||
{
|
||||
$changes = $this->objectModel->batchChangeModule($storyIdList, $moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$storyIdList = array_keys($changes);
|
||||
return $this->objectModel->getByList($storyIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch change story plan.
|
||||
*
|
||||
* @param arary $storyIdList
|
||||
* @param int $planID
|
||||
* @param int $oldPlanID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchChangePlanTest($storyIdList, $planID, $oldPlanID = 0)
|
||||
{
|
||||
$changes = $this->objectModel->batchChangePlan($storyIdList, $planID, $oldPlanID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$storyIdList = array_keys($changes);
|
||||
return $this->objectModel->getByList($storyIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch change story branch.
|
||||
*
|
||||
* @param arary $storyIdList
|
||||
* @param int $branchID
|
||||
* @param string $confirm
|
||||
* @param array $plans
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchChangeBranchTest($storyIdList, $branchID, $confirm = '', $plans = array())
|
||||
{
|
||||
$changes = $this->objectModel->batchChangeBranch($storyIdList, $branchID, $confirm, $plans);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$storyIdList = array_keys($changes);
|
||||
return $this->objectModel->getByList($storyIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch change stage.
|
||||
*
|
||||
* @param arrau $storyIdList
|
||||
* @param string $stage
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchChangeStageTest($storyIdList, $stage)
|
||||
{
|
||||
$changes = $this->objectModel->batchChangeStage($storyIdList, $stage);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$storyIdList = array_keys($changes);
|
||||
return $this->objectModel->getByList($storyIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test story batch to task.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param int $projectID
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchToTaskTest($executionID, $projectID = 0, $params = '')
|
||||
{
|
||||
$_POST = $params;
|
||||
$taskIdList = $this->objectModel->batchToTask($executionID, $projectID);
|
||||
unset($params);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
return $tester->loadModel('task')->getByList($taskIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test assign a story.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param string $assignedTo
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function assignTest($storyID, $assignedTo)
|
||||
{
|
||||
$_POST['assignedTo'] = $assignedTo;
|
||||
$this->objectModel->assign($storyID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $this->objectModel->getById($storyID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch assign story.
|
||||
*
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchAssignToTest($params)
|
||||
{
|
||||
$_POST = $params;
|
||||
$changes = $this->objectModel->batchAssignTo();
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$storyIdList = array_keys($changes);
|
||||
return $this->objectModel->getByList($storyIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get stories by assignedBy.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getByAssignedByTest($productID, $branch)
|
||||
{
|
||||
global $tester;
|
||||
$stories = $this->objectModel->getByAssignedBy($productID, $branch, $modules = array(), $account = $tester->app->user->account, $type = 'story', $orderBy = '', $pager = null);
|
||||
|
||||
$title = '';
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$title .= ',' . $story->title;
|
||||
}
|
||||
$title = trim($title, ',');
|
||||
$title = str_replace("'", '', $title);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
@@ -1,755 +0,0 @@
|
||||
<?php
|
||||
class testcaseTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('testcase');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a case.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function createTest($param)
|
||||
{
|
||||
$bugID = 0;
|
||||
|
||||
$_POST['product'] = '1';
|
||||
$_POST['module'] = '1821';
|
||||
$_POST['type'] = 'feature';
|
||||
$_POST['stage'] = array('', 'unittest');
|
||||
$_POST['story'] = '4';
|
||||
$_POST['color'] = '';
|
||||
$_POST['pri'] = '3';
|
||||
$_POST['precondition'] = '前置条件';
|
||||
$_POST['steps'] = array('1' => '1','1.1' => '1.1', '1.2' => '1.2', '2' => '2', '3' => '3', '4' => '');
|
||||
$_POST['stepType'] = array('1' => 'group','1.1' => 'item', '1.2' => 'item', '2' => 'step', '3' => 'item', '4' => 'step');
|
||||
$_POST['expects'] = array('1' => '','1.1' => '', '1.2' => '', '2' => '', '3' => '', '4' => '');
|
||||
$_POST['keywords'] = '关键词1,关键词2';
|
||||
$_POST['status'] = 'normal';
|
||||
$_POST['labels'] = array('');
|
||||
$_POST['files'] = array('');
|
||||
|
||||
foreach($param as $field => $value) $_POST[$field] = $value;
|
||||
|
||||
$objects = $this->objectModel->create($bugID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return isset($param['type']) ? dao::getError()['type'][0] : dao::getError()['title'][0];
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch create cases.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
function batchCreateTest($param)
|
||||
{
|
||||
$productID = 1;
|
||||
$branch = 0;
|
||||
$storyID = 0;
|
||||
|
||||
$module = array(0, 0, 0);
|
||||
$story = array(0, 0, 0);
|
||||
$title = array('测试批量创建1', '测试批量创建2', '测试批量创建3');
|
||||
$color = array('#3da7f5', '', '#ffaf38');
|
||||
$type = array('performance', 'config', 'install');
|
||||
$pri = array('1', '2', '3');
|
||||
$precondition = array('测试批量创建前置1', '测试批量创建前置2', '测试批量创建前置3');
|
||||
$keywords = array('测试批量创建关键词1', '测试批量创建关键词2', '测试批量创建关键词3');
|
||||
$stage = array(array('smoke'), array('bvt'), array('intergrate'));
|
||||
$needReview = array(0, 0, 0);
|
||||
|
||||
$_POST['module'] = $module;
|
||||
$_POST['story'] = $story;
|
||||
$_POST['title'] = $title;
|
||||
$_POST['color'] = $color;
|
||||
$_POST['type'] = $type;
|
||||
$_POST['pri'] = $pri;
|
||||
$_POST['precondition'] = $precondition;
|
||||
$_POST['keywords'] = $keywords;
|
||||
$_POST['stage'] = $stage;
|
||||
$_POST['needReview'] = $needReview;
|
||||
|
||||
foreach($param as $field => $value) $_POST[$field] = $value;
|
||||
|
||||
$objects = $this->objectModel->batchCreate($productID, $branch, $storyID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get cases of a module.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param int $moduleIdList
|
||||
* @param string $browseType
|
||||
* @param string $auto
|
||||
* @param string $caseType
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getModuleCasesTest($productID, $branch = 0, $moduleIdList = 0, $browseType = '', $auto = 'no', $caseType = '', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getModuleCases($productID, $branch, $moduleIdList, $browseType, $auto, $caseType, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get project cases of a module.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param int $moduleIdList
|
||||
* @param string $browseType
|
||||
* @param string $auto
|
||||
* @param string $caseType
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getModuleProjectCasesTest($productID, $branch = 0, $moduleIdList = 0, $browseType = '', $auto = 'no', $caseType = '', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getModuleProjectCases($productID, $branch, $moduleIdList, $browseType, $auto, $caseType, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get execution cases.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param string $browseType
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getExecutionCasesTest($executionID, $orderBy = 'id_desc', $pager = null, $browseType = '')
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionCases($executionID, $orderBy, $pager, $browseType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $browseType == 'all' ? $objects : count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get cases by suite.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param int $suiteID
|
||||
* @param int $moduleIdList
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param string $auto
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBySuiteTest($productID, $branch = 0, $suiteID = 0, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null, $auto = 'no')
|
||||
{
|
||||
$objects = $this->objectModel->getBySuite($productID, $branch, $suiteID, $moduleIdList, $orderBy, $pager, $auto);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get case info by ID.
|
||||
*
|
||||
* @param int $caseID
|
||||
* @param int $version
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIdTest($caseID, $version = 0)
|
||||
{
|
||||
$object = $this->objectModel->getById($caseID, $version = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get case list.
|
||||
*
|
||||
* @param string $caseIDList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByListTest($caseIDList = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getByList($caseIDList = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get test cases.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $browseType
|
||||
* @param int $queryID
|
||||
* @param string $auto
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTestCasesTest($productID, $browseType, $queryID, $auto = 'no')
|
||||
{
|
||||
$objects = $this->objectModel->getTestCases($productID, 0, $browseType, $queryID, $moduleID, '', 'id_desc', null, $auto);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get cases by assignedTo.
|
||||
*
|
||||
* @param string $account
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param string $auto
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getByAssignedToTest($account, $orderBy = 'id_desc', $pager = null, $auto = 'no')
|
||||
{
|
||||
$objects = $this->objectModel->getByAssignedTo($account, $orderBy = 'id_desc', $pager = null, $auto = 'no');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$ids = implode(array_keys($objects), ',');
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get cases by openedBy
|
||||
*
|
||||
* @param string $account
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param string $auto
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByOpenedByTest($account, $orderBy = 'id_desc', $pager = null, $auto = 'no')
|
||||
{
|
||||
$objects = $this->objectModel->getByOpenedBy($account, $orderBy = 'id_desc', $pager = null, $auto = 'no');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get cases by type.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param string $type
|
||||
* @param string $status
|
||||
* @param int $moduleID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param string $auto
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getByStatusTest($productID = 0, $branch = 0, $type = 'all', $status = 'all', $moduleID = 0, $orderBy = 'id_desc', $pager = null, $auto = 'no')
|
||||
{
|
||||
$objects = $this->objectModel->getByStatus($productID, $branch, $type, $status, $moduleID, $orderBy, $pager, $auto);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get stories' cases.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStoryCasesTest($storyID)
|
||||
{
|
||||
$objects = $this->objectModel->getStoryCases($storyID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get case pairs by product id and branch.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairsByProductTest($productID = 0, $branch = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getPairsByProduct($productID, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if(empty($objects)) return 'empty';
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get counts of some stories' cases.
|
||||
*
|
||||
* @param array $stories
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getStoryCaseCountsTest($stories)
|
||||
{
|
||||
$counts = $this->objectModel->getStoryCaseCounts($stories);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $counts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update a case.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function updateTest($param = array())
|
||||
{
|
||||
$caseId = 1;
|
||||
$case = $this->objectModel->getById($caseId);
|
||||
|
||||
$_POST['title'] = $case->title;
|
||||
$_POST['color'] = $case->color;
|
||||
$_POST['precondition'] = $case->precondition;
|
||||
$_POST['steps'] = array('用例步骤描述1');
|
||||
$_POST['stepType'] = array('step');
|
||||
$_POST['expects'] = array('这是用例预期结果1');
|
||||
$_POST['comment'] = '';
|
||||
$_POST['labels'] = '';
|
||||
$_POST['lastEditedDate'] = $case->lastEditedDate;
|
||||
$_POST['product'] = $case->product;
|
||||
$_POST['module'] = $case->module;
|
||||
$_POST['story'] = $case->story;
|
||||
$_POST['type'] = $case->type;
|
||||
$_POST['stage'] = $case->stage;
|
||||
$_POST['pri'] = $case->pri;
|
||||
$_POST['status'] = $case->status;
|
||||
$_POST['keywords'] = $case->keywords;
|
||||
|
||||
foreach($param as $field => $value) $_POST[$field] = $value;
|
||||
|
||||
$change = $this->objectModel->update('1');
|
||||
if($change == array()) $change = '没有数据更新';
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $change;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test review case.
|
||||
*
|
||||
* @param int $caseID
|
||||
* @param object $case
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function reviewTest($caseID, $case)
|
||||
{
|
||||
foreach($case as $field => $value) $_POST[$field] = $value;
|
||||
|
||||
$objects = $this->objectModel->review($caseID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch review cases.
|
||||
*
|
||||
* @param array $caseIdList
|
||||
* @param string $result
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchReviewTest($caseIdList, $result)
|
||||
{
|
||||
$objects = $this->objectModel->batchReview($caseIdList, $result);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch update cases.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchUpdateTest($index, $param = array())
|
||||
{
|
||||
$batchUpdateField['caseIDList'] = array('1' => 1, '2' => 2, '3' => 3, '4' => 4);
|
||||
$batchUpdateField['pris'] = array('1' => 1, '2' => 2, '3' => 3, '4' => 4);
|
||||
$batchUpdateField['statuses'] = array('1' => 'wait', '2' => 'normal', '3' => 'blocked', '4' => 'investigate');
|
||||
$batchUpdateField['modules'] = array('1' => 0, '2' => 0, '3' => 0, '4' => 0);
|
||||
$batchUpdateField['branches'] = array('1' => 0, '2' => 0, '3' => 0, '4' => 0);
|
||||
$batchUpdateField['story'] = array('1' => 2, '2' => 2, '3' => 2, '4' => 2);
|
||||
$batchUpdateField['product'] = array('1' => 1, '2' => 1, '3' => 1, '4' => 1);
|
||||
$batchUpdateField['title'] = array('1' => '这个是测试用例1', '2' => '这个是测试用例2', '3' => '这个是测试用例3', '4' => '这个是测试用例4');
|
||||
$batchUpdateField['color'] = array('1' => '#3da7f5', '2' => '#75c941', '3' => '#2dbdb2', '4' => '#797ec9');
|
||||
$batchUpdateField['types'] = array('1' => 'feature', '2' => 'performance', '3' => 'config', '4' => 'install');
|
||||
$batchUpdateField['precondition'] = array('1' => '这是前置条件1', '2' => '这是前置条件2', '3' => '这是前置条件3', '4' => '这是前置条件4');
|
||||
$batchUpdateField['keywords'] = array('1' => '这是关键词1', '2' => '这是关键词2', '3' => '这是关键词3', '4' => '这是关键词4');
|
||||
$batchUpdateField['stages'] = array('1' => array('unittest'), '2' => array('feature'), '3' => array('intergrate'), '4' => array('system'));
|
||||
|
||||
foreach($batchUpdateField as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->batchUpdate();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects[$index][0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch change branch.
|
||||
*
|
||||
* @param array $caseIDList
|
||||
* @param int $branchID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchChangeBranchTest($caseIDList, $branchID)
|
||||
{
|
||||
$this->objectModel->batchChangeBranch($caseIDList, $branchID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByList($caseIDList);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch change module.
|
||||
*
|
||||
* @param array $caseIDList
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchChangeModuleTest($caseIDList, $moduleID)
|
||||
{
|
||||
$this->objectModel->batchChangeModule($caseIDList, $moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByList($caseIDList);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch case type change.
|
||||
*
|
||||
* @param array $caseIdList
|
||||
* @param string $result
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchCaseTypeChangeTest($caseIdList, $result)
|
||||
{
|
||||
$this->objectModel->batchCaseTypeChange($caseIdList, $result);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByList($caseIdList);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test join steps to a string, thus can diff them.
|
||||
*
|
||||
* @param array $stepIDList
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function joinStepTest($stepIDList)
|
||||
{
|
||||
global $tester;
|
||||
$steps = $tester->dao->select('*')->from(TABLE_CASESTEP)->where('id')->in($stepIDList)->fetchAll();
|
||||
|
||||
$string = $this->objectModel->joinStep($steps);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = str_replace("\n", ' ', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create from import.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createFromImportTest($productID, $param = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$_POST['product'] = array('1' => '1', '2' => '1');
|
||||
$_POST['keywords'] = array('1' => '这是关键词1', '2' => '这是关键词2');
|
||||
$_POST['title'] = array('1' => '导入测试用例1', '2' => '导入测试用例2');
|
||||
$_POST['module'] = array('1' => '0', '2' => '0');
|
||||
$_POST['story'] = array('1' => '2', '2' => '2');
|
||||
$_POST['pri'] = array('1' => '1', '2' => '2');
|
||||
$_POST['type'] = array('1' => 'performance', '2' => 'feature');
|
||||
$_POST['stage'] = array('1' => array('0' => 'feature'), '2' => array('0' => 'unittest'));
|
||||
$_POST['precondition'] = array('1' => '这是前置条件1', '2' => '这是前置条件2');
|
||||
$_POST['stepType'] = array('1' => array('1' => 'step'), '2' => array('1' => 'step'));
|
||||
$_POST['desc'] = array('1' => array('1' => '用例步骤描述1'), '2' => array('1' => '用例步骤描述2'));
|
||||
$_POST['expect'] = array('1' => array('1' => '这是用例预期结果1'), '2' => array('1' => '这是用例预期结果2'));
|
||||
$_POST['isEndPage'] = '1';
|
||||
$_POST['pagerID'] = '1';
|
||||
|
||||
foreach($param as $field => $value) $_POST[$field] = $value;
|
||||
|
||||
$fileName = __DIR__ . DS . 'a.txt';
|
||||
fopen($fileName, 'a');
|
||||
$tester->session->fileImport = $fileName;
|
||||
|
||||
$this->objectModel->createFromImport($productID, 0);
|
||||
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_CASE)->where('product')->eq(1)->andWhere('lib')->eq(0)->markLeft()->andWhere('id')->gt(560)->orWhere('id')->in('1,2')->markRight()->fetchAll('title');
|
||||
$titles = implode(',', array_keys($objects));
|
||||
return $titles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get fields for import.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getImportFieldsTest($productID = 0)
|
||||
{
|
||||
$object = $this->objectModel->getImportFields($productID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test import case from Lib.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param array $caseIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function importFromLibTest($productID, $caseIdList = array())
|
||||
{
|
||||
$_POST['module'] = array('410' => 0, '409' => 'ditto', '408' => 'ditto', '407' => 'ditto', '406' => 'ditto', '405' => 'ditto', '404' => 'ditto', '403' => 'ditto', '402' => 'ditto', '401' => 'ditto');
|
||||
$_POST['caseIdList'] = $caseIdList;
|
||||
|
||||
$this->objectModel->importFromLib($productID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_CASE)->where('fromCaseID')->in($caseIdList)->orderBy('id_asc')->fetchAll();
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test append bugs and results.
|
||||
*
|
||||
* @param array $cases
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function appendDataTest($cases, $type = 'case')
|
||||
{
|
||||
$objects = $this->objectModel->appendData($cases, $type = 'case');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check whether force not review.
|
||||
*
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function forceNotReviewTest()
|
||||
{
|
||||
$object = $this->objectModel->forceNotReview();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object ? 1 : 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test sync case to project.
|
||||
*
|
||||
* @param int $caseID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function syncCase2ProjectTest($caseID)
|
||||
{
|
||||
global $tester;
|
||||
$tester->dao->delete()->from(TABLE_PROJECTCASE)->where('`case`')->eq($caseID)->exec();
|
||||
$case = $this->objectModel->getByID($caseID);
|
||||
$this->objectModel->syncCase2Project($case, $caseID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $tester->dao->select('*')->from(TABLE_PROJECTCASE)->where('`case`')->eq($caseID)->fetchAll();
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test deal with the relationship between the case and project when edit the case.
|
||||
*
|
||||
* @param int $caseID
|
||||
* @param string $objectType
|
||||
* @param int $objectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateCase2ProjectTest($caseID, $objectType, $objectID)
|
||||
{
|
||||
$oldCase = $this->objectModel->getByID($caseID);
|
||||
|
||||
$case = new stdclass();
|
||||
$case->title = $oldCase->title;
|
||||
$case->color = $oldCase->color;
|
||||
$case->precondition = $oldCase->precondition;
|
||||
$case->lastEditedDate = $oldCase->lastEditedDate;
|
||||
$case->product = $objectType == 'product' ? $objectID : $oldCase->product;
|
||||
$case->module = $oldCase->module;
|
||||
$case->story = $objectType == 'story' ? $objectID : $oldCase->story;
|
||||
$case->type = $oldCase->type;
|
||||
$case->stage = $oldCase->stage;
|
||||
$case->pri = $oldCase->pri;
|
||||
$case->status = $oldCase->status;
|
||||
$case->keywords = $oldCase->keywords;
|
||||
$case->version = $oldCase->version + 1;
|
||||
$case->linkCase = $oldCase->linkCase;
|
||||
$case->lastEditedBy = $oldCase->lastEditedBy;
|
||||
$case->branch = $oldCase->branch;
|
||||
|
||||
$this->objectModel->updateCase2Project($oldCase, $case, $caseID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_PROJECTCASE)->where('`case`')->eq($caseID)->fetchAll();
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get status for different method.
|
||||
*
|
||||
* @param string $methodName
|
||||
* @param object $case
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStatusTest($methodName, $case = null, $param = array())
|
||||
{
|
||||
if($methodName == 'update')
|
||||
{
|
||||
$case = $this->objectModel->getByID(1);
|
||||
$_POST['title'] = $case->title;
|
||||
$_POST['color'] = $case->color;
|
||||
$_POST['precondition'] = $case->precondition;
|
||||
$_POST['steps'] = array('用例步骤描述1');
|
||||
$_POST['stepType'] = array('step');
|
||||
$_POST['expects'] = array('这是用例预期结果1');
|
||||
$_POST['comment'] = '';
|
||||
$_POST['labels'] = '';
|
||||
$_POST['lastEditedDate'] = $case->lastEditedDate;
|
||||
$_POST['product'] = $case->product;
|
||||
$_POST['module'] = $case->module;
|
||||
$_POST['story'] = $case->story;
|
||||
$_POST['type'] = $case->type;
|
||||
$_POST['stage'] = $case->stage;
|
||||
$_POST['pri'] = $case->pri;
|
||||
$_POST['status'] = $case->status;
|
||||
$_POST['keywords'] = $case->keywords;
|
||||
|
||||
foreach($param as $field => $value) $_POST[$field] = $value;
|
||||
}
|
||||
|
||||
$objects = $this->objectModel->getStatus($methodName, $case);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError()[0];
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,266 +0,0 @@
|
||||
<?php
|
||||
class testreportTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
global $app;
|
||||
$this->objectModel = $tester->loadModel('testreport');
|
||||
$this->testtask = $tester->loadModel('testtask');
|
||||
$this->build = $tester->loadModel('build');
|
||||
$app->loadLang('bug');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create report.
|
||||
*
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function createTest($param)
|
||||
{
|
||||
$begin_date = date('Y-m-d');
|
||||
$end_date = date('Y-m-d',strtotime("+7 day"));
|
||||
$builds = array('11');
|
||||
$labels = array();
|
||||
|
||||
$createFields = array('begin' => $begin_date, 'end' => $end_date, 'product' => '1', 'execution' => '101', 'tasks' => '1', 'objectID' => '1', 'objectType' => 'testtask', 'owner' => '', 'title' => '', 'report' => '', 'labels' => $labels, 'builds' => $builds, 'cases' => '');
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$reportID = $this->objectModel->create();
|
||||
unset($_POST);
|
||||
if(dao::isError()) return dao::getError();
|
||||
$objects = $this->objectModel->getByID($reportID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function updateTest($reportID, $param)
|
||||
{
|
||||
$report = $this->objectModel->getByID($reportID);
|
||||
|
||||
$begin_date = $report->begin;
|
||||
$end_date = $report->end;
|
||||
$builds = $report->builds;
|
||||
$labels = array();
|
||||
|
||||
$createFields = array('begin' => $begin_date, 'end' => $end_date, 'product' => $report->product, 'execution' => $report->execution, 'tasks' => $report->tasks, 'objectID' => $report->objectID, 'objectType' => $report->objectType, 'owner' => '', 'title' => '', 'report' => '', 'labels' => $labels, 'builds' => $builds, 'cases' => '');
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->update($reportID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = $this->objectModel->getByID($reportID);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get report by id.
|
||||
*
|
||||
* @param int $reportID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
|
||||
public function getByIdTest($reportID)
|
||||
{
|
||||
$objects = $this->objectModel->getById($reportID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Get report list.
|
||||
*
|
||||
* @param int $objectID
|
||||
* @param string $objectType
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getListTest($objectID, $objectType, $extra = '', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getList($objectID, $objectType, $extra, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bug info and summary.
|
||||
*
|
||||
* @param array $tasksIDs
|
||||
* @param array $productIdList
|
||||
* @param int $reportID
|
||||
* @param array $buildIDs
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBug4ReportTest($taskIDs, $productIdList, $reportID, $buildIDs)
|
||||
{
|
||||
$tasks = $taskIDs ? $this->testtask->getByList($taskIDs) : array();
|
||||
$builds = $buildIDs ? $this->build->getByList($buildIDs) : array();
|
||||
$report = $this->objectModel->getByID($reportID);
|
||||
|
||||
$objects = $this->objectModel->getBug4Report($tasks, $productIdList, $report->begin, $report->end, $builds);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get task cases.
|
||||
*
|
||||
* @param array $taskID
|
||||
* @param int $reportID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function getTaskCasesTest($taskID, $reportID, $idList = '', $pager = null)
|
||||
{
|
||||
$task = $taskID ? $this->testtask->getByList($taskID) : array();
|
||||
$report = $this->objectModel->getByID($reportID);
|
||||
|
||||
$objects = $this->objectModel->getTaskCases($task, $report->begin, $report->end, $idList, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Get caseID list.
|
||||
*
|
||||
* @param int $reportID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function getCaseIdListTest($reportID)
|
||||
{
|
||||
$objects = $this->objectModel->getCaseIdList($reportID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Get result summary.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $reportID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getResultSummaryTest($taskID, $reportID)
|
||||
{
|
||||
$tasks = $taskID ? $this->testtask->getByList($taskID) : array();
|
||||
$report = $this->objectModel->getByID($reportID);
|
||||
$cases = $this->objectModel->getTaskCases($tasks, $report->begin, $report->end);
|
||||
|
||||
$objects = $this->objectModel->getResultSummary($tasks, $cases, $report->begin, $report->end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get per run result for testreport.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $reportID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getPerCaseResult4ReportTest($taskID, $reportID)
|
||||
{
|
||||
$tasks = $taskID ? $this->testtask->getByList($taskID) : array();
|
||||
$report = $this->objectModel->getByID($reportID);
|
||||
|
||||
$objects = $this->objectModel->getPerCaseResult4Report($tasks, $report->cases, $report->begin, $report->end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Get per case runner for testreport.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $reportID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getPerCaseRunner4ReportTest($taskID, $reportID)
|
||||
{
|
||||
$tasks = $taskID ? $this->testtask->getByList($taskID) : array();
|
||||
$report = $this->objectModel->getByID($reportID);
|
||||
$objects = $this->objectModel->getPerCaseRunner4Report($tasks, $report->cases, $report->begin, $report->end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Get bugs for test
|
||||
*
|
||||
* @param array $builds
|
||||
* @param array $product
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function getBugs4TestTest($buildIdList, $product, $taskID, $type = 'build')
|
||||
{
|
||||
$task = $this->testtask->getByID($taskID);
|
||||
$builds = $this->build->getByList($buildIdList);
|
||||
$begin = !empty($begin) ? date("Y-m-d", strtotime($begin)) : $task->begin;
|
||||
$end = !empty($end) ? date("Y-m-d", strtotime($end)) : $task->end;
|
||||
$objects = $this->objectModel->getBugs4Test($builds, $product, $begin, $end, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Get stories for test
|
||||
*
|
||||
* @param array $builds
|
||||
* @return void
|
||||
*/
|
||||
public function getStories4TestTest($buildIdList)
|
||||
{
|
||||
$builds = $this->build->getByList($buildIdList);
|
||||
$objects = $this->objectModel->getStories4Test($builds);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Get pairs.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairsTest($productID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getPairs($productID);
|
||||
if(dao::isError()) return dao::getError();
|
||||
if($objects) $objects = array_keys($objects);
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
<?php
|
||||
class testsuiteTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('testsuite');
|
||||
}
|
||||
|
||||
public function selectTest($products, $productID, $currentModule, $currentMethod, $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->select($products, $productID, $currentModule, $currentMethod, $extra);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a test suite.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return array|int
|
||||
*/
|
||||
public function createTest($productID, $name, $type)
|
||||
{
|
||||
$_POST['name'] = $name;
|
||||
$_POST['desc'] = '';
|
||||
$_POST['type'] = $type;
|
||||
$_POST['uid'] = '62538b850bb9d';
|
||||
|
||||
$objects = $this->objectModel->create($productID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get test suites of a product.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getSuitesTest($productID, $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getSuites($productID, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get unit suite.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUnitSuitesTest($productID, $orderBy = 'id_desc')
|
||||
{
|
||||
$objects = $this->objectModel->getUnitSuites($productID, $orderBy);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get test suite info by id.
|
||||
*
|
||||
* @param int $suiteID
|
||||
* @param bool $setImgSize
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIdTest($suiteID, $setImgSize = false)
|
||||
{
|
||||
$objects = $this->objectModel->getById($suiteID, $setImgSize);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update a test suite.
|
||||
*
|
||||
* @param int $suiteID
|
||||
* @access public
|
||||
* @return bool|array
|
||||
*/
|
||||
public function updateTest($suiteID, $name, $type)
|
||||
{
|
||||
$_POST['name'] = $name;
|
||||
$_POST['desc'] = '';
|
||||
$_POST['type'] = $type;
|
||||
$_POST['uid'] = '62538b850bb9d';
|
||||
|
||||
$objects = $this->objectModel->update($suiteID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test link cases.
|
||||
*
|
||||
* @param int $suiteID
|
||||
* @param array $cases
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkCaseTest($suiteID, $cases)
|
||||
{
|
||||
$_POST['cases'] = $cases;
|
||||
foreach($cases as $case)
|
||||
{
|
||||
$_POST['versions'][$case] = 1;
|
||||
}
|
||||
|
||||
$this->objectModel->linkCase($suiteID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_SUITECASE)->where('suite')->eq($suiteID)->andWhere('`case`')->in($cases)->fetchAll();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get linked cases for suite.
|
||||
*
|
||||
* @param int $suiteID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param bool $append
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLinkedCasesTest($suiteID, $orderBy = 'id_desc', $pager = null, $append = true)
|
||||
{
|
||||
$objects = $this->objectModel->getLinkedCases($suiteID, $orderBy, $pager, $append);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get unlinked cases for suite.
|
||||
*
|
||||
* @param int $suiteID
|
||||
* @param int $param
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUnlinkedCasesTest($suiteID, $param = 0, $pager = null)
|
||||
{
|
||||
|
||||
$suite = $this->objectModel->getById($suiteID);
|
||||
$objects = $this->objectModel->getUnlinkedCases($suite, $param, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete suite and library.
|
||||
*
|
||||
* @param int $suiteID
|
||||
* @param string $table
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function deleteTest($suiteID, $table = '')
|
||||
{
|
||||
$objects = $this->objectModel->delete($suiteID, $table);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get not imported cases.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $libID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getNotImportedCasesTest($productID, $libID, $orderBy = 'id_desc', $pager = null, $browseType = '', $queryID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getNotImportedCases($productID, $libID, $orderBy, $pager, $browseType, $queryID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
<?php
|
||||
class testtaskTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('testtask');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create testtask.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($projectID, $params)
|
||||
{
|
||||
$_POST = $params;
|
||||
$taskID = $this->objectModel->create($projectID);
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $this->objectModel->getById($taskID);
|
||||
}
|
||||
|
||||
public function update($taskID)
|
||||
{
|
||||
$objects = $this->objectModel->update($taskID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function startTest($taskID)
|
||||
{
|
||||
$objects = $this->objectModel->start($taskID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function closeTest($taskID)
|
||||
{
|
||||
$objects = $this->objectModel->close($taskID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function blockTest($taskID)
|
||||
{
|
||||
$objects = $this->objectModel->block($taskID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function activateTest($taskID)
|
||||
{
|
||||
$objects = $this->objectModel->activate($taskID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function linkCaseTest($taskID, $type)
|
||||
{
|
||||
$objects = $this->objectModel->linkCase($taskID, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getRunsTest($taskID, $moduleID, $orderBy, $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getRuns($taskID, $moduleID, $orderBy, $pager = null);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserRunsTest($taskID, $user, $modules = '', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getUserRuns($taskID, $user, $modules = '', $orderBy = 'id_desc', $pager = null);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getTaskCasesTest($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task)
|
||||
{
|
||||
$objects = $this->objectModel->getTaskCases($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getUserTestTaskPairsTest($account, $limit = 0, $status = 'all', $skipProductIDList = array(), $skipExecutionIDList = array())
|
||||
{
|
||||
$objects = $this->objectModel->getUserTestTaskPairs($account, $limit = 0, $status = 'all', $skipProductIDList = array(), $skipExecutionIDList = array());
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getRunByIdTest($runID)
|
||||
{
|
||||
$objects = $this->objectModel->getRunById($runID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function createResultTest($runID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->createResult($runID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function batchRunTest($runCaseType = 'testcase', $taskID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->batchRun($runCaseType = 'testcase', $taskID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getResultsTest($runID, $caseID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getResults($runID, $caseID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function printCellTest($col, $run, $users, $task, $branches, $mode = 'datatable')
|
||||
{
|
||||
$objects = $this->objectModel->printCell($col, $run, $users, $task, $branches, $mode = 'datatable');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getToAndCcListTest($testtask)
|
||||
{
|
||||
$objects = $this->objectModel->getToAndCcList($testtask);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function importUnitResultTest($productID)
|
||||
{
|
||||
$objects = $this->objectModel->importUnitResult($productID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function processAutoResultTest($testtaskID, $productID, $suites, $cases, $results, $suiteNames = array(), $caseTitles = array(), $auto = 'unit')
|
||||
{
|
||||
$objects = $this->objectModel->processAutoResult($testtaskID, $productID, $suites, $cases, $results, $suiteNames = array(), $caseTitles = array(), $auto = 'unit');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function parseCppXMLResultTest($fileName, $productID, $frame)
|
||||
{
|
||||
$objects = $this->objectModel->parseCppXMLResult($fileName, $productID, $frame);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function parseXMLResultTest($fileName, $productID, $frame)
|
||||
{
|
||||
$objects = $this->objectModel->parseXMLResult($fileName, $productID, $frame);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function parseZTFUnitResultTest($caseResults, $frame, $productID, $jobID, $compileID)
|
||||
{
|
||||
$objects = $this->objectModel->parseZTFUnitResult($caseResults, $frame, $productID, $jobID, $compileID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function parseZTFFuncResultTest($caseResults, $frame, $productID, $jobID, $compileID)
|
||||
{
|
||||
$objects = $this->objectModel->parseZTFFuncResult($caseResults, $frame, $productID, $jobID, $compileID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,367 +0,0 @@
|
||||
<?php
|
||||
class todoTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('todo');
|
||||
$tester->app->loadClass('dao');
|
||||
$_SERVER['HTTP_HOST'] = 'test.zentao.net';
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a todo.
|
||||
*
|
||||
* @param string $account
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function createTest($account, $param = array())
|
||||
{
|
||||
$config = array('day' => '', 'specify' => array('month' => 0, 'day' => 1), 'type' => 'day', 'beforeDays' => 0, 'end' => '');
|
||||
if(isset($param->date)) $param->date = $param->date == 'today' ? date('Y-m-d',time()) : date('Y-m-d',strtotime('+3 days'));
|
||||
|
||||
$createFields['config'] = $config;
|
||||
$createFields['type'] = 'custom';
|
||||
$createFields['name'] = '';
|
||||
$createFields['pri'] = 3;
|
||||
$createFields['desc'] = '';
|
||||
$createFields['status'] = 'wait';
|
||||
$createFields['begin'] = '0830';
|
||||
$createFields['end'] = '0900';
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objectID = $this->objectModel->create(date('Y').date('m'), $account);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return array_values(dao::getError())[0][0];
|
||||
|
||||
$object = $objectID ? $this->objectModel->getByID($objectID) : 0;
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch create todos.
|
||||
*
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchCreateTest($param = array())
|
||||
{
|
||||
$createFields['date'] = date('Y-m-d',time());
|
||||
|
||||
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->batchCreate();
|
||||
|
||||
$todos = $this->objectModel->getByList($objects);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $todos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update a todo.
|
||||
*
|
||||
* @param int $todoID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function updateTest($todoID, $param)
|
||||
{
|
||||
global $tester;
|
||||
$object = $tester->dbh->query("SELECT * FROM " . TABLE_TODO ." WHERE id = $todoID")->fetch();
|
||||
|
||||
foreach($object as $field => $value)
|
||||
{
|
||||
if(in_array($field, array_keys($param)))
|
||||
{
|
||||
$_POST[$field] = $param[$field];
|
||||
}
|
||||
else
|
||||
{
|
||||
$_POST[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$change = $this->objectModel->update($todoID);
|
||||
if($change == array()) $change = '没有数据更新';
|
||||
|
||||
unset($_POST);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $change;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test batch update todos.
|
||||
*
|
||||
* @param array $param
|
||||
* @param int $todoID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchUpdateTest($param, $todoID)
|
||||
{
|
||||
$todoIDList = array('1' => '1', '2' => '2', '3' => '3');
|
||||
$dates = array('1' => date('Y-m-d',strtotime('+1 month')), '2' => date('Y-m-d',strtotime('-1 month +1 day')), '3' => date('Y-m-d',strtotime('-1 month +2 day')));
|
||||
$types = array('1' => 'custom', '2' => 'bug', '3' => 'task');
|
||||
$pris = array('1' => '1', '2' => '2', '3' => '3');
|
||||
$names = array('1' => '自定义1的待办', '2' => 'BUG2的待办', '3' => '任务3的待办');
|
||||
$descs = array('1' => '这是一个待办的描述1', '2' => '这是一个待办的描述2', '3' => '这是一个待办的描述3');
|
||||
$begins = array('1' => '1000', '2' => '1002', '3' => '1004');
|
||||
$ends = array('1' => '1400', '2' => '1402', '3' => '1404');
|
||||
$status = array('1' => 'wait', '2' => 'doing', '3' => 'done');
|
||||
|
||||
$batchUpdateFields['todoIDList'] = $todoIDList;
|
||||
$batchUpdateFields['dates'] = $dates;
|
||||
$batchUpdateFields['types'] = $types;
|
||||
$batchUpdateFields['pris'] = $pris;
|
||||
$batchUpdateFields['names'] = $names;
|
||||
$batchUpdateFields['descs'] = $descs;
|
||||
$batchUpdateFields['begins'] = $begins;
|
||||
$batchUpdateFields['ends'] = $ends;
|
||||
$batchUpdateFields['status'] = $status;
|
||||
|
||||
foreach($batchUpdateFields as $field => $value) $_POST[$field] = $value;
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$changes = $this->objectModel->batchUpdate();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $changes[$todoID];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test start a todo.
|
||||
*
|
||||
* @param int $todoID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function startTest($todoID)
|
||||
{
|
||||
$this->objectModel->start($todoID);
|
||||
$object = $this->objectModel->getByID($todoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test finish a todo.
|
||||
*
|
||||
* @param int $todoID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function finishTest($todoID)
|
||||
{
|
||||
$this->objectModel->finish($todoID);
|
||||
$object = $this->objectModel->getByID($todoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get info of a todo.
|
||||
*
|
||||
* @param int $todoID
|
||||
* @param bool $setImgSize
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIdTest($todoID, $setImgSize = false)
|
||||
{
|
||||
$object = $this->objectModel->getById($todoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get todo list of a user.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $account
|
||||
* @param string $status
|
||||
* @param int $limit
|
||||
* @param mixed $pager
|
||||
* @param string $orderBy
|
||||
* @param status $status
|
||||
* @param begin" $begin"
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getListTest($type = 'today', $account = '', $status = 'all', $limit = 0, $pager = null, $orderBy = "date, status, begin")
|
||||
{
|
||||
$objects = $this->objectModel->getList($type, $account, $status, $limit, $pager, $orderBy);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get todo by id list.
|
||||
*
|
||||
* @parami array $todoIDList
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getByListTest($todoIDList = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getByList($todoIDList);
|
||||
|
||||
$name = '';
|
||||
foreach($objects as $todo) $name .= ',' . $todo->name;
|
||||
$name = trim($name, ',');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* isClickableTest
|
||||
*
|
||||
* @param object $todo
|
||||
* @param string $action
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function isClickableTest($todo, $action)
|
||||
{
|
||||
$object = $this->objectModel->isClickable($todo, $action);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object ? 1 : 2;
|
||||
}
|
||||
|
||||
public function createByCycleTest($todo)
|
||||
{
|
||||
$todo->cycle = '1';
|
||||
$todo->type = 'cycle';
|
||||
$todo->pri = 3;
|
||||
$todo->desc = '';
|
||||
$todo->status = 'wait';
|
||||
$todo->begin = '0830';
|
||||
$todo->end = '0900';
|
||||
$todo->account = 'admin';
|
||||
$todo->idvalue = '0';
|
||||
$todo->vision = 'rnd';
|
||||
$todo->assignedTo = 'admin';
|
||||
$todo->assignedBy = 'admin';
|
||||
$todo->assignedDate = date('Y-m-d', time());
|
||||
$todo->date = date('Y-m-d', time());
|
||||
|
||||
$todo->config = str_replace('2022-03-23', date('Y-m-d', time()), $todo->config);
|
||||
|
||||
global $tester;
|
||||
$tester->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec();
|
||||
$todoID = $tester->dao->lastInsertID();
|
||||
|
||||
$this->objectModel->createByCycle(array($todoID => $todo));
|
||||
|
||||
$objects = $tester->dao->select('id')->from(TABLE_TODO)->where('idvalue')->eq($todoID)->andWhere('deleted')->eq('0')->fetchAll();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test activate todo.
|
||||
*
|
||||
* @param int $todoID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function activateTest($todoID)
|
||||
{
|
||||
$this->objectModel->activate($todoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getById($todoID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test close a todo.
|
||||
*
|
||||
* @param int $todoID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function closeTest($todoID)
|
||||
{
|
||||
$this->objectModel->close($todoID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getById($todoID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test assign todo.
|
||||
*
|
||||
* @param int $todoID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function assignToTest($todoID, $param = array())
|
||||
{
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
if(!isset($_POST['future']) and !isset($_POST['date'])) $_POST['date'] = date('Y-m-d', time());
|
||||
|
||||
$this->objectModel->assignTo($todoID);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getById($todoID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get todo count.
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getCountTest($account = '')
|
||||
{
|
||||
$count = $this->objectModel->getCount($account);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
@@ -1,828 +0,0 @@
|
||||
<?php
|
||||
class treeTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('tree');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get module by id.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getByIDTest($moduleID)
|
||||
{
|
||||
$object = $this->objectModel->getByID($moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* get all module pairs with path.
|
||||
*
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getAllModulePairsTest($type = 'task')
|
||||
{
|
||||
$objects = $this->objectModel->getAllModulePairs($type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test build the sql query.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $type
|
||||
* @param int $startModule
|
||||
* @param string $branch
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function buildMenuQueryTest($rootID, $type, $startModule = 0, $branch = 'all')
|
||||
{
|
||||
$string = $this->objectModel->buildMenuQuery($rootID, $type, $startModule, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create an option menu in html.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $type
|
||||
* @param int $startModule
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getOptionMenuTest($rootID, $type = 'story', $startModule = 0, $branch = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getOptionMenu($rootID, $type, $startModule, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* getModulePairsTest
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $viewType
|
||||
* @param string $showModule
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getModulePairsTest($rootID, $viewType = 'story', $showModule = 'end', $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->getModulePairs($rootID, $viewType, $showModule, $extra);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return count($objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create an option menu of task in html.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @param int $startModule
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTaskOptionMenuTest($rootID, $productID = 0, $startModule = 0, $extra = '')
|
||||
{
|
||||
$objects = $this->objectModel->getTaskOptionMenu($rootID, $productID = 0, $startModule = 0, $extra = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$names = '';
|
||||
foreach($objects as $object) $names .= ',' . $object;
|
||||
return $names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test build tree array.
|
||||
*
|
||||
* @param array & $&treeMenu
|
||||
* @param array $modules
|
||||
* @param int $moduleID
|
||||
* @param string $moduleName
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function buildTreeArrayTest(& $treeMenu, $modules, $moduleID, $moduleName = '/')
|
||||
{
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
$moduleName = $module->name;
|
||||
|
||||
$this->objectModel->buildTreeArray($treeMenu, $modules, $module, $moduleName);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$objects = array();
|
||||
foreach($treeMenu as $id => $string) $objects[$id] = strlen($string);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get full task tree.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTaskStructureTest($rootID, $productID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getTaskStructure($rootID, $productID = 0);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$child = '';
|
||||
foreach($objects as $object)
|
||||
{
|
||||
if(is_array($object)) $child .= isset($object['children']) ? $object['name'] . ':' . count($object['children']) . ';' : $object['name'] . ':0';
|
||||
if(is_object($object)) $child .= isset($object->children) ? "$object->name:" . count($object->children) . ';' : "$object->name:0";
|
||||
}
|
||||
return $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get tree structure.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTreeStructureTest($rootID, $type)
|
||||
{
|
||||
$objects = $this->objectModel->getTreeStructure($rootID, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$child = '';
|
||||
foreach($objects as $object) $child .= isset($object->children) ? "$object->id:" . count($object->children) . ';' : "$object->id:0;";
|
||||
return $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get execution modules.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param bool $parent
|
||||
* @param string $linkObject
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTaskTreeModulesTest($executionID, $parent = false, $linkObject = 'story')
|
||||
{
|
||||
$objects = $this->objectModel->getTaskTreeModules($executionID, $parent, $linkObject);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$ids = '';
|
||||
foreach($objects as $object) $ids .= ',' . $object;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create story link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param array $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createStoryLinkTest($moduleID, $extra = array())
|
||||
{
|
||||
$type = '';
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
|
||||
$link = $this->objectModel->createStoryLink($type, $module, $extra);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = preg_replace("/.*(projectstory|execution|product).*(title='.*').*/", '$1 $2', $link);
|
||||
$string = str_replace("\n", '', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create task link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param int $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createTaskLinkTest($moduleID, $extra)
|
||||
{
|
||||
$type = '';
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
|
||||
$link = $this->objectModel->createTaskLink($type, $module, $extra);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = preg_replace("/.*task.(\d*).*byModule.(\d*).*(title='.*').*/", '$1 $2 $3', $link);
|
||||
$string = str_replace("\n", '', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create requirment link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createRequirementLinkTest($moduleID)
|
||||
{
|
||||
$type = '';
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
|
||||
$link = $this->objectModel->createBugLink($type, $module);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = preg_replace("/.*(title='.*').*/", '$1', $link);
|
||||
$string = str_replace("\n", '', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create manage link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param array $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createManageLinkTest($moduleID, $extra)
|
||||
{
|
||||
$type = 0;
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
|
||||
$link = $this->objectModel->createManageLink($type, $module, $extra);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return substr($link, 0, 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create task manage link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param array $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createTaskManageLinkTest($moduleID, $extra)
|
||||
{
|
||||
$type = '';
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
|
||||
$link = $this->objectModel->createTaskManageLink($type, $module, $extra);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = preg_replace("/((.*) <a.*tree.([a-z]*).*>([\x{4e00}-\x{9fa5}]*)<\/a>.*)|( <input .* \/>)/u", '$2 $3 $4', $link);
|
||||
$string = str_replace("\n", '', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test reate link of a bug.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createBugLinkTest($moduleID)
|
||||
{
|
||||
$type = '';
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
|
||||
$link = $this->objectModel->createBugLink($type, $module);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = preg_replace("/.*(title='.*').*/", '$1', $link);
|
||||
$string = str_replace("\n", '', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create case link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param array $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createCaseLinkTest($moduleID, $extra = array('branchID' => 0))
|
||||
{
|
||||
$type = '';
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
|
||||
$link = $this->objectModel->createCaseLink($type, $module, $extra);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = preg_replace("/.*(title='.*').*/", '$1', $link);
|
||||
$string = str_replace("\n", '', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create test task link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param int $extra
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createTestTaskLinkTest($moduleID, $extra)
|
||||
{
|
||||
$type = '';
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
|
||||
$link = $this->objectModel->createTestTaskLink($type, $module, $extra);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = preg_replace("/.*(title='.*').*/", '$1', $link);
|
||||
$string = str_replace("\n", '', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create case lib link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createCaseLibLinkTest($moduleID)
|
||||
{
|
||||
$type = '';
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
|
||||
$link = $this->objectModel->createCaseLibLink($type, $module);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = preg_replace("/.*(title='.*').*/", '$1', $link);
|
||||
$string = str_replace("\n", '', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create feedback link.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function createFeedbackLinkTest($moduleID)
|
||||
{
|
||||
$type = '';
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
|
||||
$link = $this->objectModel->createFeedbackLink($type, $module);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$string = preg_replace("/.*(title='.*').*/", '$1', $link);
|
||||
$string = str_replace("\n", '', $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get sons of a module.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $moduleID
|
||||
* @param string $type
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSonsTest($rootID, $moduleID, $type = 'root', $branch = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getSons($rootID, $moduleID, $type, $branch);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$ids = '';
|
||||
foreach($objects as $object) $ids .= ',' . $object->id;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get sons of a task module.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTaskSonsTest($rootID, $productID, $moduleID)
|
||||
{
|
||||
$objects = $this->objectModel->getTaskSons($rootID, $productID, $moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$ids = '';
|
||||
foreach($objects as $object) $ids .= ',' . $object->id;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get id list of a module's childs.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getAllChildIdTest($moduleID)
|
||||
{
|
||||
$objects = $this->objectModel->getAllChildId($moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$ids = '';
|
||||
foreach($objects as $objectID) $ids .= ',' . $objectID;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get project module.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectModuleTest($projectID, $productID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getProjectModule($projectID, $productID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$ids = '';
|
||||
foreach($objects as $objectID) $ids .= ',' . $objectID;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get parents of a module.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getParentsTest($moduleID)
|
||||
{
|
||||
$objects = $this->objectModel->getParents($moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$ids = '';
|
||||
foreach($objects as $object) $ids .= ',' . $object->id;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get product by moduleID.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getProductTest($moduleID)
|
||||
{
|
||||
$object = $this->objectModel->getProduct($moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get the module that its type == 'story'.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getStoryModuleTest($moduleID)
|
||||
{
|
||||
$object = $this->objectModel->getStoryModule($moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get modules name.
|
||||
*
|
||||
* @param array $moduleIdList
|
||||
* @param bool $allPath
|
||||
* @param bool $branchPath
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getModulesNameTest($moduleIdList, $allPath = true, $branchPath = false)
|
||||
{
|
||||
$objects = $this->objectModel->getModulesName($moduleIdList, $allPath, $branchPath);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update modules' order.
|
||||
*
|
||||
* @param array $orders
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function updateOrderTest($orders)
|
||||
{
|
||||
$objects = $this->objectModel->updateOrder($orders);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_MODULE)->where('id')->in(array_keys($orders))->orderBy('`order` asc')->fetchAll();
|
||||
$ids = '';
|
||||
foreach($objects as $object) $ids .= ',' . $object->id;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test manage childs of a module.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $type
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function manageChildTest($rootID, $type, $param)
|
||||
{
|
||||
$_POST['allProduct'] = 100;
|
||||
$_POST['productModule'] = 0;
|
||||
|
||||
foreach($param as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$this->objectModel->manageChild($rootID, $type);
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_MODULE)->where('parent')->eq($param['parentModuleID'])->andWhere('deleted')->eq(0)->fetchAll();
|
||||
|
||||
$names = '';
|
||||
foreach($objects as $object) $names .= ',' . $object->name;
|
||||
return $names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update a module.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param array $param
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function updateTest($moduleID, $param)
|
||||
{
|
||||
$fields = array('root', 'branch', 'parent', 'name', 'short');
|
||||
$module = $this->objectModel->getByID($moduleID);
|
||||
foreach($fields as $field)
|
||||
{
|
||||
if(isset($param[$field]))
|
||||
{
|
||||
$_POST[$field] = $param[$field];
|
||||
}
|
||||
else
|
||||
{
|
||||
$_POST[$field] = $module->$field;
|
||||
}
|
||||
}
|
||||
|
||||
$this->objectModel->update($moduleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByID($moduleID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test change root.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param int $oldRoot
|
||||
* @param int $newRoot
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function changeRootTest($moduleID, $oldRoot, $newRoot, $type)
|
||||
{
|
||||
$this->objectModel->changeRoot($moduleID, $oldRoot, $newRoot, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_STORY)->where('module')->eq($oldRoot)->andWhere('deleted')->eq(0)->fetchAll();
|
||||
return $type == 'story' ? count($objects) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete a module.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param object $null
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function deleteTest($moduleID, $null = null)
|
||||
{
|
||||
$this->objectModel->delete($moduleID, $null);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$object = $this->objectModel->getByID($moduleID);
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test fix the path, grade fields according to the id and parent fields.
|
||||
*
|
||||
* @param int $root
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function fixModulePathTest($root, $type)
|
||||
{
|
||||
$this->objectModel->fixModulePath($root, $type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('*')->from(TABLE_MODULE)->where('root')->eq($root)->andWhere('type')->eq($type)->andWhere('deleted')->eq(0)->fetchAll('id');
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check unique module name.
|
||||
*
|
||||
* @param object $module
|
||||
* @param array $modules
|
||||
* @param array $branches
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function checkUniqueTest($module, $modules = array(), $branches = array())
|
||||
{
|
||||
global $tester;
|
||||
$modules = $tester->dao->select('id,name')->from(TABLE_MODULE)->where('id')->in($modules)->fetchPairs();
|
||||
|
||||
$repeatName = $this->objectModel->checkUnique($module, $modules, $branches);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $repeatName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test check merge module version.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $viewType
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function isMergeModuleTest($rootID, $viewType)
|
||||
{
|
||||
$object = $this->objectModel->isMergeModule($rootID, $viewType);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $object ? 1 : 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get full trees.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param string $viewType
|
||||
* @param string $branchID
|
||||
* @param int $currentModuleID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getProductStructureTest($rootID, $viewType, $branchID = 'all', $currentModuleID = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getProductStructure($rootID, $viewType, $branchID, $currentModuleID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$child = '';
|
||||
foreach($objects as $object) $child .= isset($object->children) ? "$object->id:" . count($object->children) . ';' : "$object->id:0;";
|
||||
return $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get full task tree.
|
||||
*
|
||||
* @param int $root
|
||||
* @param string $viewType
|
||||
* @param array $keepModules
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getDataStructureTest($root, $viewType, $keepModules = array())
|
||||
{
|
||||
global $tester;
|
||||
|
||||
$stmt = $tester->dbh->query($this->objectModel->buildMenuQuery($root, $viewType));
|
||||
|
||||
$objects = $this->objectModel->getDataStructure($stmt, $viewType, $keepModules);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$child = '';
|
||||
foreach($objects as $object) $child .= isset($object->children) ? "$object->id:" . count($object->children) . ';' : "$object->id:0;";
|
||||
return $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get all doc structure.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getDocStructureTest()
|
||||
{
|
||||
$objects = $this->objectModel->getDocStructure();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$child = '';
|
||||
foreach($objects as $object) $child .= isset($object[0]->children) ? $object[0]->id . ':' . count($object[0]->children) . ';' : "$object[0]->id:0;";
|
||||
return $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create module.
|
||||
*
|
||||
* @param array $postData
|
||||
* @access public
|
||||
* @return object|bool
|
||||
*/
|
||||
public function createModuleTest($postData)
|
||||
{
|
||||
global $tester;
|
||||
foreach($postData as $key => $value) $_POST[$key] = $value;
|
||||
$object = $this->objectModel->createModule();
|
||||
|
||||
unset($_POST);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
$error = dao::getError();
|
||||
return $error[0];
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
@@ -1,281 +0,0 @@
|
||||
<?php
|
||||
class tutorialTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('tutorial');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check novice.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function checkNoviceTest()
|
||||
{
|
||||
$this->app->user->modifyPassword = 1;
|
||||
$objects = $this->objectModel->checkNovice();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial product pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProductPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProductPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module pairs for tutorial.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getModulePairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getModulePairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial product.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProductTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProduct();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product stats for tutorial.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProductStatsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProductStats();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects[0][0]['products'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project for tutorial.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProjectTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProject();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial project pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProjectPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getProjectPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project stats for tutorial.
|
||||
*
|
||||
* @param string $browseType
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProjectStatsTest($browseType = '')
|
||||
{
|
||||
$objects = $this->objectModel->getProjectStats($browseType = '');
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial stories.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getStoriesTest()
|
||||
{
|
||||
$objects = $this->objectModel->getStories();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial Execution pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial execution.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionTest()
|
||||
{
|
||||
$objects = $this->objectModel->getExecution();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial execution products.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionProductsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionProducts();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial execution stories.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionStoriesTest()
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionStories();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial execution story pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExecutionStoryPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getExecutionStoryPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial team members.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTeamMembersTest()
|
||||
{
|
||||
$objects = $this->objectModel->getTeamMembers();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get team members pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTeamMembersPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getTeamMembersPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorial user pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getUserPairsTest()
|
||||
{
|
||||
$objects = $this->objectModel->getUserPairs();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tutorialed.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTutorialedTest()
|
||||
{
|
||||
$objects = $this->objectModel->getTutorialed();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,473 +0,0 @@
|
||||
<?php
|
||||
class webhookTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('webhook');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by ID Test
|
||||
*
|
||||
* @param int mixed $id
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByIDTest($id)
|
||||
{
|
||||
$objects = $this->objectModel->getByID($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by type Test
|
||||
*
|
||||
* @param string mixed $type
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByTypeTest($type)
|
||||
{
|
||||
$objects = $this->objectModel->getByType($type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bind account Test
|
||||
*
|
||||
* @param int mixed $webhookID
|
||||
* @param string mixed $webhookType
|
||||
* @param int mixed $openID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getBindAccountTest($webhookID, $webhookType, $openID)
|
||||
{
|
||||
$objects = $this->objectModel->getBindAccount($webhookID, $webhookType, $openID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Test
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param int mixed $pager
|
||||
* @param bool mixed $decode
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getListTest($orderBy = 'id_desc', $pager = null, $decode = true)
|
||||
{
|
||||
$objects = $this->objectModel->getList($orderBy, $pager, $decode);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get log list Test
|
||||
*
|
||||
* @param int mixed $id
|
||||
* @param string $orderBy
|
||||
* @param int mixed $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLogListTest($id, $orderBy = 'date_desc', $pager = null)
|
||||
{
|
||||
$objects = $this->objectModel->getLogList($id, $orderBy, $pager);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data list Test
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDataListTest()
|
||||
{
|
||||
global $tester;
|
||||
$objects = $this->objectModel->getDataList();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bound users Test
|
||||
*
|
||||
* @param int mixed $webhookID
|
||||
* @param array $users
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getBoundUsersTest($webhookID, $users = array())
|
||||
{
|
||||
$objects = $this->objectModel->getBoundUsers($webhookID, $users);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function createTest($webhooks)
|
||||
{
|
||||
$posts = array();
|
||||
$posts['type'] = '';
|
||||
$posts['name'] = '';
|
||||
$posts['url'] = '';
|
||||
$posts['secret'] = '';
|
||||
$posts['agentId'] = '';
|
||||
$posts['appKey'] = '';
|
||||
$posts['appSecret'] = '';
|
||||
$posts['wechatCorpId'] = '';
|
||||
$posts['wechatCorpSecret'] = '';
|
||||
$posts['wechatAgentId'] = '';
|
||||
$posts['feishuAppId'] = '';
|
||||
$posts['feishuAppSecret'] = '';
|
||||
$posts['domain'] = '';
|
||||
$posts['sendType'] = '';
|
||||
$posts['products'] = array();
|
||||
$posts['executions'] = array();
|
||||
$posts['desc'] = '';
|
||||
|
||||
foreach($posts as $field => $defaultvalue) $_POST[$field] = $defaultvalue;
|
||||
foreach($webhooks as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->create();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Test
|
||||
*
|
||||
* @param aray mixed $create
|
||||
* @param int mixed $id
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function updateTest($create, $update)
|
||||
{
|
||||
global $tester;
|
||||
$webhook1 = $this->createTest($create);
|
||||
$id = $tester->dao->select('id')->from(TABLE_WEBHOOK)->where('name')->eq($create['name'])->fetch('id');
|
||||
|
||||
if($id == null)
|
||||
{
|
||||
a($webhook);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
$post = array();
|
||||
$post['type'] = '';
|
||||
$post['name'] = '';
|
||||
$post['url'] = '';
|
||||
$post['secret'] = '';
|
||||
$post['domain'] = '';
|
||||
$post['products'] = array();
|
||||
$post['executions'] = array();
|
||||
$post['desc'] = '';
|
||||
foreach($post as $field => $defaultvalue) $_POST[$field] = $defaultvalue;
|
||||
foreach($update as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->update($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind Test
|
||||
*
|
||||
* @param array mixed $create
|
||||
* @param array mixed $bind
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function bindTest($create, $bind)
|
||||
{
|
||||
global $tester;
|
||||
$result = $this->createTest($create);
|
||||
$id = $tester->dao->select('id')->from(TABLE_WEBHOOK)->where('name')->eq($create['name'])->fetch('id');
|
||||
|
||||
if($id == null)
|
||||
{
|
||||
a($result);
|
||||
return;
|
||||
}else
|
||||
{
|
||||
foreach($bind as $key => $value) $_POST[$key] = $value;
|
||||
|
||||
$objects = $this->objectModel->bind($id);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Test
|
||||
*
|
||||
* @param string mixed $objectType
|
||||
* @param int mixed $objectID
|
||||
* @param string mixed $actionType
|
||||
* @param int mixed $actionID
|
||||
* @param string $actor
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function sendTest($objectType, $objectID, $actionType, $actionID, $actor = '')
|
||||
{
|
||||
$objects = $this->objectModel->send($objectType, $objectID, $actionType, $actionID, $actor);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build data Test
|
||||
*
|
||||
* @param string mixed $objectType
|
||||
* @param int mixed $objectID
|
||||
* @param string mixed $actionType
|
||||
* @param int mixed $actionID
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function buildDataTest($objectType, $objectID, $actionType, $actionID)
|
||||
{
|
||||
static $webhooks = array();
|
||||
if(!$webhooks) $webhooks = $this->getListTest();
|
||||
if(!$webhooks) return true;
|
||||
|
||||
foreach($webhooks as $id => $webhook)
|
||||
{
|
||||
$objects = $this->objectModel->buildData($objectType, $objectID, $actionType, $actionID, $webhook);
|
||||
}
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get view link Test
|
||||
*
|
||||
* @param string mixed $objectType
|
||||
* @param int mixed $objectID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getViewLinkTest($objectType, $objectID)
|
||||
{
|
||||
$objects = $this->objectModel->getViewLink($objectType, $objectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dingding data Test
|
||||
*
|
||||
* @param string mixed $title
|
||||
* @param string mixed $text
|
||||
* @param string mixed $mobile
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDingdingDataTest($title, $text, $mobile)
|
||||
{
|
||||
$objects = $this->objectModel->getDingdingData($title, $text, $mobile);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bearychat data Test
|
||||
*
|
||||
* @param string mixed $text
|
||||
* @param string mixed $mobile
|
||||
* @param string mixed $email
|
||||
* @param string mixed $objectType
|
||||
* @param int mixed $objectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBearychatDataTest($text, $mobile, $email, $objectType, $objectID)
|
||||
{
|
||||
$objects = $this->objectModel->getBearychatData($text, $mobile, $email, $objectType, $objectID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get weixin data Test
|
||||
*
|
||||
* @param string mixed $title
|
||||
* @param string mixed $text
|
||||
* @param string mixed $mobile
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getWeixinDataTest($title, $text, $mobile)
|
||||
{
|
||||
$objects = $this->objectModel->getWeixinData($title, $text, $mobile);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get feishu data Test
|
||||
*
|
||||
* @param string mixed $title
|
||||
* @param string mixed $text
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getFeishuDataTest($title, $text)
|
||||
{
|
||||
$objects = $this->objectModel->getFeishuData($title, $text);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get open id list Test
|
||||
*
|
||||
* @param int mixed $actionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getOpenIdListTest($webhookID, $actionID)
|
||||
{
|
||||
static $webhooks = array();
|
||||
if(!$webhooks) $webhooks = $this->getListTest();
|
||||
if(!$webhooks) return true;
|
||||
|
||||
foreach($webhooks as $id => $webhook)
|
||||
{
|
||||
$objects = $this->objectModel->getOpenIdList($webhook->id, $actionID);
|
||||
}
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch hook Test
|
||||
*
|
||||
* @param object mixed $webhook
|
||||
* @param object mixed $sendData
|
||||
* @param int $actionID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function fetchHookTest($objectType, $objectID, $actionType, $actionID = 0)
|
||||
{
|
||||
static $webhooks = array();
|
||||
if(!$webhooks) $webhooks = $this->getListTest();
|
||||
if(!$webhooks) return true;
|
||||
|
||||
foreach($webhooks as $id => $webhook)
|
||||
{
|
||||
$postData = $this->objectModel->buildData($objectType, $objectID, $actionType, $actionID, $webhook);
|
||||
$objects = $this->objectModel->fetchHook($webhook, $postData, $actionID);
|
||||
}
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save data Test
|
||||
*
|
||||
* @param int mixed $webhookID
|
||||
* @param int mixed $actionID
|
||||
* @param string mixed $data
|
||||
* @param string $actor
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function saveDataTest($objectType, $objectID, $actionType, $webhookID, $actionID, $actor = '')
|
||||
{
|
||||
static $webhooks = array();
|
||||
if(!$webhooks) $webhooks = $this->getListTest();
|
||||
if(!$webhooks) return true;
|
||||
|
||||
foreach($webhooks as $id => $webhook)
|
||||
{
|
||||
$postData = $this->objectModel->buildData($objectType, $objectID, $actionType, $actionID, $webhook);
|
||||
$objects = $this->objectModel->saveData($webhookID, $actionID, $postData, $actor);
|
||||
}
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save log Test
|
||||
*
|
||||
* @param object mixed $webhook
|
||||
* @param int mixed $actionID
|
||||
* @param string mixed $data
|
||||
* @param string mixed $result
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function saveLogTest($webhook, $actionID, $data, $result)
|
||||
{
|
||||
$objects = $this->objectModel->saveLog($webhook, $actionID, $data, $result);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sent status Test
|
||||
*
|
||||
* @param array mixed $idList
|
||||
* @param string mixed $status
|
||||
* @param string $time
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setSentStatusTest($idList, $status, $time = '')
|
||||
{
|
||||
$objects = $this->objectModel->setSentStatus($idList, $status, $time);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,376 +0,0 @@
|
||||
<?php
|
||||
class weeklyTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('weekly');
|
||||
$this->projectModel = $tester->loadModel('project');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* GetPageNav
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getPageNavTest($projectID, $date)
|
||||
{
|
||||
$project = $this->projectModel->getById($projectID);
|
||||
$pageNav = $this->objectModel->getPageNav($project, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$start_str = mb_strpos($pageNav,"ass='btn'>") + mb_strlen("class='btn'>");
|
||||
$end_str = mb_strpos($pageNav,"</a>") - $start_str;
|
||||
$objects = mb_substr($pageNav,$start_str,$end_str);
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetWeekPairs
|
||||
*
|
||||
* @param int $begin
|
||||
* @param int $end
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function getWeekPairsTest($begin, $end)
|
||||
{
|
||||
switch($begin)
|
||||
{
|
||||
case '1':
|
||||
$begin = date('Y-m-d');
|
||||
break;
|
||||
case '2':
|
||||
$begin = date('Y-m-d', strtotime(date('Y-m-d')."- 6 days"));
|
||||
break;
|
||||
case '3':
|
||||
$begin = date('Y-m-d', strtotime(date('Y-m-d') . "+ 6 days"));
|
||||
break;
|
||||
case '':
|
||||
$begin = '';
|
||||
break;
|
||||
}
|
||||
|
||||
switch($begin)
|
||||
{
|
||||
case '1':
|
||||
$end = date('Y-m-d');
|
||||
break;
|
||||
case '2':
|
||||
$end = date('Y-m-d', strtotime(date('Y-m-d')."- 6 days"));
|
||||
break;
|
||||
case '3':
|
||||
$end = date('Y-m-d', strtotime(date('Y-m-d') . "+ 6 days"));
|
||||
break;
|
||||
case '':
|
||||
$end = '';
|
||||
break;
|
||||
}
|
||||
|
||||
$objects = $this->objectModel->getWeekPairs($begin, $end);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetFromDB
|
||||
*
|
||||
* @param int $project
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
|
||||
public function getFromDBTest($project, $date)
|
||||
{
|
||||
$objects = $this->objectModel->getFromDB($project, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save data.
|
||||
*
|
||||
* @param int $project
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function saveTest($project, $date)
|
||||
{
|
||||
$objects = $this->objectModel->save($project, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
$weekly = $this->objectModel->getFromDB($project, $date);
|
||||
return $weekly;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetWeekSN
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
|
||||
public function getWeekSNTest($begin, $date)
|
||||
{
|
||||
$objects = $this->objectModel->getWeekSN($begin, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get monday for a date.
|
||||
*
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
|
||||
public function getThisMondayTest($date)
|
||||
{
|
||||
$objects = $this->objectModel->getThisMonday($date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetThisSunday
|
||||
*
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
|
||||
public function getThisSundayTest($date)
|
||||
{
|
||||
$objects = $this->objectModel->getThisSunday($date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetLastDay
|
||||
*
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getLastDayTest($date)
|
||||
{
|
||||
$objects = $this->objectModel->getLastDay($date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getStaff
|
||||
*
|
||||
* @param int $project
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStaffTest($project, $date = '')
|
||||
{
|
||||
$objects = $this->objectModel->getStaff($project, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getFinished
|
||||
*
|
||||
* @param int $project
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getFinishedTest($project, $date = '')
|
||||
{
|
||||
$objects = $this->objectModel->getFinished($project, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getPostponed
|
||||
*
|
||||
* @param int $project
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getPostponedTest($project, $date = '')
|
||||
{
|
||||
$objects = $this->objectModel->getPostponed($project, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getTasksOfNextWeek
|
||||
*
|
||||
* @param int $project
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getTasksOfNextWeekTest($project, $date = '')
|
||||
{
|
||||
$objects = $this->objectModel->getTasksOfNextWeek($project, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getWorkloadByType
|
||||
*
|
||||
* @param int $project
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getWorkloadByTypeTest($project, $date = '')
|
||||
{
|
||||
$objects = $this->objectModel->getWorkloadByType($project, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getPlanedTaskByWeek
|
||||
*
|
||||
* @param int $project
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPlanedTaskByWeekTest($project, $date = '')
|
||||
{
|
||||
$objects = $this->objectModel->getPlanedTaskByWeek($project, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getPVEV
|
||||
*
|
||||
* @param int $project
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getPVEVTest($projectID, $date = '')
|
||||
{
|
||||
$objects = $this->objectModel->getPVEV($projectID, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects['PV'] . ',' . $objects['EV'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get AC data.
|
||||
*
|
||||
* @param int $project
|
||||
* @param string $date
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getACTest($project, $date = '')
|
||||
{
|
||||
$objects = $this->objectModel->getAC($project, $date);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get SV data.
|
||||
*
|
||||
* @param int $ev
|
||||
* @param int $pv
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getSVTest($ev, $pv)
|
||||
{
|
||||
$objects = $this->objectModel->getSV($ev, $pv);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getCV
|
||||
*
|
||||
* @param int $ev
|
||||
* @param int $ac
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getCVTest($ev, $ac)
|
||||
{
|
||||
$objects = $this->objectModel->getCV($ev, $ac);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getTips
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $data
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTipsTest($type = 'progress', $data = 0)
|
||||
{
|
||||
$objects = $this->objectModel->getTips($type, $data);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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'); // 测试创建下一个动作日期组 上周
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的日期
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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动态
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
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: 这是一个系统日志测试备注
|
||||
...
|
||||
@@ -1,68 +0,0 @@
|
||||
-- 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
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的动态
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/action.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 actionModel->getActionCondition();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取用户可以看到的动态的条件 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$action = new actionTest();
|
||||
|
||||
r($action->getActionConditionTest()) && p() && e('0'); // 获取用户可以看到的动态的条件
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的信息
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的动作个数
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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'); // 查找今天的动态
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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倒序的今天之后的动态
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的历史记录
|
||||
@@ -1,98 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的动态信息
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的动态信息
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的关联信息
|
||||
@@ -1,99 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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 的动态信息
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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排序的回收站信息
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的回收站信息
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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 的对象类型列表
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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是数组的动态
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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'); // 测试今天之后是否有动态
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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'); // 隐藏回收站全部信息
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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 历史记录
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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'); // 处理所有动态
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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 的项目动态
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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 进行阅读操作
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的阶段
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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'); // 测试保存不存在类型的数据
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/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的备注
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/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'); //正常测试
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/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();
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/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'); // 验证网络连接
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/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->checkWeak();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> 0
|
||||
|
||||
*/
|
||||
$account = 'admin';
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->checkWeakTest($account)) && p() && e('0'); //正常测试
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user