Merge branch 'cyy_test'

This commit is contained in:
liyuchun
2022-05-07 02:53:34 +00:00
164 changed files with 5658 additions and 238 deletions
+6 -6
View File
@@ -29,9 +29,9 @@ class feedbackEntry extends Entry
$feedback->publicStatus = $feedback->public;
$feedback->productName = $data->data->product;
$feedback->moduleName = $data->data->modulePath[0]->name ? $data->data->modulePath[0]->name : '/';
$feedback->moduleName = isset($data->data->modulePath[0]->name) ? $data->data->modulePath[0]->name : '/';
$feedback->resultType = $data->data->type;
if($feedback->resultInfo->deleted == 0) $feedback->resultStatus = $this->loadModel('feedback')->processStatus($feedback->resultType, $feedback->resultInfo);
if(isset($feedback->resultInfo) and $feedback->resultInfo->deleted == 0) $feedback->resultStatus = $this->loadModel('feedback')->processStatus($feedback->resultType, $feedback->resultInfo);
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
@@ -69,14 +69,14 @@ class feedbackEntry extends Entry
/**
* DELETE method.
*
* @param int $productID
* @param int $feedbackID
* @access public
* @return void
*/
public function delete($productID)
public function delete($feedbackID)
{
$control = $this->loadController('product', 'delete');
$control->delete($productID, 'yes');
$control = $this->loadController('feedback', 'delete');
$control->delete($feedbackID, 'yes');
$this->getData();
$this->sendSuccess(200, 'success');
+16 -56
View File
@@ -512,62 +512,36 @@ class router extends baseRouter
if($this->config->requestType != 'GET')
{
/* e.g. $this->URI = /$module-close-1.html. */
$params = explode($this->config->requestFix, $this->URI); // $params = array($module, 'close', 1);
$params = explode($this->config->requestFix, $this->URI); // $params = array($module, 'close', 1);
/* Remove module and method. */
$params = array_slice($params, 2); // $params = array(1);
$params = array_slice($params, 2); // $params = array(1);
/* Prepend other params. */
if($methodName == 'operate') array_unshift($params, $this->rawMethod); // $params = array('close', 1);
if($methodName == 'batchOperate') array_unshift($params, $this->rawMethod); // $params = array('close', 1);
if($methodName == 'browse')
{
if(!(isset($params[0]) and $params[0] == 'bysearch')) array_unshift($params, 'browse');
}
array_unshift($params, $methodName); // $params = array('operate', 1);
array_unshift($params, $moduleName); // $params = array('flow', 'operate', 1);
array_unshift($params, $this->rawModule); // $params = array($module, 'close', 1);
array_unshift($params, $methodName); // $params = array('operate', $module, 'close', 1);
array_unshift($params, $moduleName); // $params = array('flow', 'operate', $module, 'close', 1);
$this->URI = implode($this->config->requestFix, $params); // $this->URI = flow-operate-$module-close-1.html;
$this->URI = implode($this->config->requestFix, $params); // $this->URI = flow-operate-1.html;
}
else
{
/* Extract $path and $query from $params. */
/* e.g. $tshi->URI = /index.php?m=$module&f=browse&mode=search&label=1. */
$params = parse_url($this->URI); // $params = array('path' => '/index.php', 'query' => m=$module&f=browse&mode=search&label=1;
extract($params); // $path = '/index.php'; $query = 'm=$module&f=browse&mode=search&label=1';
parse_str($query, $params); // $params = array('m' => $module, 'f' => 'browse', 'mode' = 'search', 'label' => 1);
$params = array_reverse($params); // $params = array('label' => 1, 'mode' => 'search');
if($methodName == 'operate') $params['action'] = $params[$this->config->methodVar];
if($methodName == 'batchOperate') $params['action'] = $params[$this->config->methodVar];
/* e.g. $tshi->URI = /index.php?m=$module&f=close&id=1. */
$params = parse_url($this->URI); // $params = array('path' => '/index.php', 'query' => m=$module&f=close&id=1;
extract($params); // $path = '/index.php'; $query = 'm=$module&f=close&id=1';
parse_str($query, $params); // $params = array('m' => $module, 'f' => 'close', 'id' => 1);
/* Remove module and method. */
unset($params[$this->config->moduleVar]); // $params = array('f' => 'browse', 'mode' => 'search', 'label' => 1);
unset($params[$this->config->methodVar]); // $params = array('mode' => 'search', 'label' => 1);
unset($params[$this->config->moduleVar]); // $params = array('f' => 'close', 'id' => 1);
unset($params[$this->config->methodVar]); // $params = array('id' => 1);
/* Prepend other params. */
if($methodName == 'browse')
{
if(!(isset($params['mode']) and $params['mode'] == 'bysearch')) $params['mode'] = 'browse';
}
$params = array_reverse($params); // $params = array('id' => 1);
$params['module'] = $this->rawModule; // $param = array('label' => 1, 'mode' => 'search', 'module' => $module);
$params[$this->config->methodVar] = $methodName; // $param = array('label' => 1, 'mode' => 'search', 'module' => $module, 'f' => 'browse');
$params[$this->config->moduleVar] = $moduleName; // $param = array('label' => 1, 'mode' => 'search', 'module' => $module, 'f' => 'browse', 'm' => 'flow');
$params[$this->config->methodVar] = $methodName; // $param = array('id' => 1, 'f' => 'operate');
$params[$this->config->moduleVar] = $moduleName; // $param = array('id' => 1, 'f' => 'operate', 'm' => 'flow');
$params = array_reverse($params); // $params = array('m' => 'flow', 'f' => 'browse', 'module' => $module, 'mode' => 'search', 'label' => 1);
$params = array_reverse($params); // $params = array('m' => 'flow', 'f' => 'operate', 'id' => 1);
/* Reset $_GET for setParamsByGET. */
$get = $params;
foreach($_GET as $key => $value)
{
if(!isset($get[$key])) $get[$key] = $value;
}
$_GET = $get;
$this->URI = $path . '?' . http_build_query($params); // $this->URI = '/index.php?m=flow&f=browse&module=$module&mode=search&label=1';
$this->URI = $path . '?' . http_build_query($params); // $this->URI = '/index.php?m=flow&f=operate&id=1';
}
}
@@ -632,20 +606,6 @@ class router extends baseRouter
{
if(isset($_GET['project'])) $this->session->set('project', $_GET['project']);
/* If the isFlow is true, reset the passed params. */
if($this->isFlow)
{
$passedParams = array_reverse($passedParams);
/* 如果请求的方法名不是browse、create、edit、view、delete、export中的任何一个,则需要添加action参数来传递请求的方法名。 */
/* If the requested method name is not any of browse, create, edit, view, delete, or export, you need to add an action parameter to pass the requested method name. */
if(isset($this->config->workflowaction->default->actions) and !in_array($this->rawMethod, $this->config->workflowaction->default->actions)) $passedParams['action'] = $this->rawMethod;
/* 添加module参数来传递请求的模块名。 */
/* Add the module parameter to pass the requested module name. */
$passedParams['module'] = $this->rawModule;
$passedParams = array_reverse($passedParams);
}
/* display参数用来标记请求是否来自禅道客户端的卡片展示页面,此处应该删掉以避免对方法调用产生影响。 */
/* The display parameter is used to mark whether the request comes from the card display page of the ZenTao client. It should be deleted here to avoid affecting the method call. */
+4 -101
View File
@@ -194,7 +194,6 @@ class gitModel extends model
$commits += count($logs);
}
}
}
$this->repo->updateCommitCount($repo->id, $commits);
@@ -296,6 +295,8 @@ class gitModel extends model
*/
public function getRepoTags($repo)
{
if(empty($repo->client) or empty($repo->path) or !isset($repo->account) or !isset($repo->password) or !isset($repo->encoding)) return false;
$scm = $this->app->loadClass('scm');
$scm->setEngine($repo);
return $scm->tags('');
@@ -311,6 +312,8 @@ class gitModel extends model
*/
public function getRepoLogs($repo, $fromRevision)
{
if(empty($repo->client) or empty($repo->path) or !isset($repo->account) or !isset($repo->password) or !isset($repo->encoding)) return false;
$scm = $this->app->loadClass('scm');
$scm->setEngine($repo);
$logs = $scm->log('', $fromRevision);
@@ -371,106 +374,6 @@ class gitModel extends model
return $parsedLog;
}
/**
* Diff a url.
*
* @param string $path
* @param int $revision
* @access public
* @return string|bool
*/
public function diff($path, $revision)
{
$repo = $this->getRepoByURL($path);
if(!$repo) return false;
$this->setClient($repo);
if(empty($this->client)) return false;
putenv('LC_CTYPE=en_US.UTF-8');
chdir($repo->path);
exec("{$this->client} config core.quotepath false");
$subPath = substr($path, strlen($repo->path));
if($subPath[0] == '/' or $subPath[0] == '\\') $subPath = substr($subPath, 1);
$encodings = explode(',', $this->config->git->encodings);
foreach($encodings as $encoding)
{
$encoding = trim($encoding);
if($encoding == 'utf-8') continue;
$subPath = helper::convertEncoding($subPath, 'utf-8', $encoding);
if($subPath) break;
}
exec("$this->client rev-list -n 2 $revision -- $subPath", $lists);
if(count($lists) == 2) list($nowRevision, $preRevision) = $lists;
$cmd = "$this->client diff $preRevision $nowRevision -- $subPath 2>&1";
$diff = `$cmd`;
$encoding = isset($repo->encoding) ? $repo->encoding : 'utf-8';
if($encoding and $encoding != 'utf-8') $diff = helper::convertEncoding($diff, $encoding);
return $diff;
}
/**
* Cat a url.
*
* @param string $path
* @param int $revision
* @access public
* @return string|bool
*/
public function cat($path, $revision)
{
$repo = $this->getRepoByURL($path);
if(!$repo) return false;
$this->setClient($repo);
if(empty($this->client)) return false;
putenv('LC_CTYPE=en_US.UTF-8');
$subPath = substr($path, strlen($repo->path));
if($subPath[0] == '/' or $subPath[0] == '\\') $subPath = substr($subPath, 1);
$encodings = explode(',', $this->config->git->encodings);
foreach($encodings as $encoding)
{
$encoding = trim($encoding);
if($encoding == 'utf-8') continue;
$subPath = helper::convertEncoding($subPath, 'utf-8', $encoding);
if($subPath) break;
}
chdir($repo->path);
exec("{$this->client} config core.quotepath false");
$cmd = "$this->client show $revision:$subPath 2>&1";
$code = `$cmd`;
$encoding = isset($repo->encoding) ? $repo->encoding : 'utf-8';
if($encoding and $encoding != 'utf-8') $code = helper::convertEncoding($code, $encoding);
return $code;
}
/**
* Get repo by url.
*
* @param string $url
* @access public
* @return object|bool
*/
public function getRepoByURL($url)
{
foreach($this->config->git->repos as $repo)
{
if(empty($repo['path'])) continue;
if(strpos($url, $repo['path']) !== false) return (object)$repo;
}
return false;
}
/**
* Pring log.
*
+8 -3
View File
@@ -74,6 +74,8 @@ class holidayModel extends model
->batchCheck($this->config->holiday->require->create, 'notempty')
->check('end', 'ge', $holiday->begin)
->exec();
$lastInsertID = $this->dao->lastInsertID();
if(dao::isError()) return false;
$beginDate = $this->post->begin;
@@ -87,7 +89,7 @@ class holidayModel extends model
$this->updateTaskPlanDuration($beginDate, $endDate);
$this->updateTaskRealDuration($beginDate, $endDate);
return $this->dao->lastInsertID();
return $lastInsertID;
}
/**
@@ -172,13 +174,16 @@ class holidayModel extends model
->andWhere('end')->ge($begin)
->fetchAll('id');
$naturalDays = $this->getDaysBetween($begin, $end);
$workingDays = array();
foreach($records as $record)
{
$dates = $this->getDaysBetween($record->begin, $record->end);
$dates = $this->getDaysBetween($record->begin, $record->end);
$workingDays = array_merge($workingDays, $dates);
}
return $workingDays;
return array_intersect($naturalDays, $workingDays);
}
/**
+1 -1
View File
@@ -486,7 +486,7 @@ class jobModel extends model
}
/**
* Exec jenkins pipeline.
* Exec jenkins pipeline.
*
* @param object $job
* @param object $repo
+7 -2
View File
@@ -77,8 +77,7 @@ class settingModel extends model
$item->section = $section;
$item->key = $key;
$item->value = $value;
if($vision) $item->vision = $vision;
$item->vision = empty($vision) ? '' : $vision;
$this->dao->replace(TABLE_CONFIG)->data($item)->exec();
}
@@ -164,6 +163,12 @@ class settingModel extends model
*/
public function createDAO($params, $method = 'select')
{
$params['vision'] = isset($params['vision']) ? $params['vision'] : '';
$params['owner'] = isset($params['owner']) ? $params['owner'] : '';
$params['module'] = isset($params['module']) ? $params['module'] : '';
$params['section'] = isset($params['section']) ? $params['section'] : '';
$params['key'] = isset($params['key']) ? $params['key'] : '';
return $this->dao->$method('*')->from(TABLE_CONFIG)->where('1 = 1')
->beginIF($params['vision'])->andWhere('vision')->in($params['vision'])->fi()
->beginIF($params['owner'])->andWhere('owner')->in($params['owner'])->fi()
+2
View File
@@ -15,6 +15,7 @@ $config->upgrade->maxVersion['max2_7'] = '16_3';
$config->upgrade->maxVersion['max2_8'] = '16_4';
$config->upgrade->maxVersion['max3_0_beta1'] = '16_5_beta1';
$config->upgrade->maxVersion['max3_0'] = '16_5';
$config->upgrade->maxVersion['max3_1_beta1'] = '17_0_beta1';
$config->upgrade->bizVersion = array();
$config->upgrade->bizVersion['biz1_0'] = '9_5_1';
@@ -68,6 +69,7 @@ $config->upgrade->bizVersion['biz6_3'] = '16_3';
$config->upgrade->bizVersion['biz6_4'] = '16_4';
$config->upgrade->bizVersion['biz6_5_beta1'] = '16_5_beta1';
$config->upgrade->bizVersion['biz6_5'] = '16_5';
$config->upgrade->bizVersion['biz7_0_beta1'] = '17_0_beta1';
$config->upgrade->proVersion = array();
$config->upgrade->proVersion['pro1_0'] = '3_1';
+23 -4
View File
@@ -101,7 +101,7 @@ class upgradeModel extends model
$this->saveLogs("Execute $openVersion");
$this->execSQL($this->getUpgradeFile(str_replace('_', '.', $openVersion)));
$this->executeOpen($openVersion, $fromEdition, $executedXuanxuan);
$this->executeOpen($openVersion, $fromEdition, $executedXuanxuan, $fromVersion);
/* Execute pro. */
foreach($chargedVersions['pro'] as $proVersion)
@@ -147,10 +147,11 @@ class upgradeModel extends model
* @param string $openVersion
* @param string $fromEdition
* @param bool $executedXuanxuan
* @param string $fromVersion
* @access public
* @return void
*/
public function executeOpen($openVersion, $fromEdition, $executedXuanxuan)
public function executeOpen($openVersion, $fromEdition, $executedXuanxuan, $fromVersion)
{
switch($openVersion)
{
@@ -497,7 +498,7 @@ class upgradeModel extends model
break;
case '16_5':
$this->updateProjectStatus();
$this->updateStoryReviewer();
$this->updateStoryReviewer($fromVersion);
break;
}
@@ -6174,11 +6175,29 @@ class upgradeModel extends model
/**
* Update the story reviewer when 12 version to 15.
*
* @param string $fromVersion
* @access public
* @return void
*/
public function updateStoryReviewer()
public function updateStoryReviewer($fromVersion)
{
$isOldVersion = false;
$fromVersion = str_replace('_', '.', $fromVersion);
if(is_numeric($fromVersion[0]) and version_compare($fromVersion, '12.5.3', '<='))
{
$isOldVersion = true;
}
elseif($fromVersion[0] == 'p' and version_compare($fromVersion, 'pro9.0.3', '<='))
{
$isOldVersion = true;
}
elseif($fromVersion[0] == 'b' and version_compare($fromVersion, 'biz4.1.3', '<='))
{
$isOldVersion = true;
}
if(!$isOldVersion) return;
$stories = $this->dao->select('t1.*,t2.PO,t2.createdBy')->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->where('t1.deleted')->eq('0')
+1 -1
View File
@@ -343,7 +343,7 @@ class weeklyModel extends model
$monday = $this->getThisMonday($date);
$nextMonday = date('Y-m-d', strtotime("$monday +7 days"));
$executions = $this->loadModel('execution')->getList($status = 'all', $limit = 0, $productID = 0, $branch = 0, $project);
$executions = $this->loadModel('execution')->getList($project);
$executionIdList = array_keys($executions);
return $this->dao->select('*')
+57
View File
@@ -0,0 +1,57 @@
<?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;
}
/**
* Sync compile status.
*
* @param int $jobID
* @access public
* @return string
*/
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 = $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();
$this->objectModel->syncCompileStatus($compile, $notCompileMR);
$compile = $tester->loadModel('compile')->getByID($compileID);
if(dao::isError()) return dao::getError();
return $compile;
}
}
+516
View File
@@ -0,0 +1,516 @@
<?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->app->loadConfig('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->app->loadConfig('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;
}
public function extractKETableCSSTest($content)
{
$objects = $this->objectModel->extractKETableCSS($content);
if(dao::isError()) return dao::getError();
return $objects;
}
public function checkPrivLibTest($object, $extra = '')
{
$objects = $this->objectModel->checkPrivLib($object, $extra = '');
if(dao::isError()) return dao::getError();
return $objects;
}
public function checkPrivDocTest($object)
{
$objects = $this->objectModel->checkPrivDoc($object);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getAllLibsByTypeTest($type, $pager = null, $product = '')
{
$objects = $this->objectModel->getAllLibsByType($type, $pager = null, $product = '');
if(dao::isError()) return dao::getError();
return $objects;
}
public function getAllLibGroupsTest($appendLibs = '')
{
$objects = $this->objectModel->getAllLibGroups($appendLibs = '');
if(dao::isError()) return dao::getError();
return $objects;
}
public function getLimitLibsTest($type, $limit = 0)
{
$objects = $this->objectModel->getLimitLibs($type, $limit = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getSubLibGroupsTest($type, $idList)
{
$objects = $this->objectModel->getSubLibGroups($type, $idList);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getLibsByObjectTest($type, $objectID, $mode = '', $appendLib = 0)
{
$objects = $this->objectModel->getLibsByObject($type, $objectID, $mode = '', $appendLib = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getOrderedObjectsTest($objectType = 'product')
{
$objects = $this->objectModel->getOrderedObjects($objectType = 'product');
if(dao::isError()) return dao::getError();
return $objects;
}
public function statLibCountsTest($idList)
{
$objects = $this->objectModel->statLibCounts($idList);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getLibFilesTest($type, $objectID, $orderBy, $pager = null)
{
$objects = $this->objectModel->getLibFiles($type, $objectID, $orderBy, $pager = null);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getFileSourcePairsTest($files)
{
$objects = $this->objectModel->getFileSourcePairs($files);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getFileIconTest($files)
{
$objects = $this->objectModel->getFileIcon($files);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getDocTreeTest($libID)
{
$objects = $this->objectModel->getDocTree($libID);
if(dao::isError()) return dao::getError();
return $objects;
}
public function fillDocsInTreeTest($node, $libID)
{
$objects = $this->objectModel->fillDocsInTree($node, $libID);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getProductCrumbTest($productID, $executionID = 0)
{
$objects = $this->objectModel->getProductCrumb($productID, $executionID = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function setLibUsersTest($type, $objectID)
{
$objects = $this->objectModel->setLibUsers($type, $objectID);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getLibIdListByProjectTest($projectID = 0)
{
$objects = $this->objectModel->getLibIdListByProject($projectID = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getStatisticInfoTest()
{
$objects = $this->objectModel->getStatisticInfo();
if(dao::isError()) return dao::getError();
return $objects;
}
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;
}
public function getToAndCcListTest($doc)
{
$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;
}
public function checkAutoloadPageTest($doc)
{
$objects = $this->objectModel->checkAutoloadPage($doc);
if(dao::isError()) return dao::getError();
return $objects;
}
}
+413
View File
@@ -0,0 +1,413 @@
<?php
class fileTest
{
public function __construct()
{
global $tester;
$this->objectModel = $tester->loadModel('file');
}
public function __constructTest()
{
$objects = $this->objectModel->construct();
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* 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;
}
public function saveUploadTest($objectType = '', $objectID = '', $extra = '', $filesName = 'files', $labelsName = 'labels')
{
$objects = $this->objectModel->saveUpload($objectType = '', $objectID = '', $extra = '', $filesName = 'files', $labelsName = 'labels');
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* 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;
}
public function saveUploadFileTest($file, $uid)
{
$objects = $this->objectModel->saveUploadFile($file, $uid);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* 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;
}
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;
}
public function getExportTemplateTest($module)
{
$objects = $this->objectModel->getExportTemplate($module);
if(dao::isError()) return dao::getError();
return $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;
}
public function saveExportTemplateTest($module)
{
$objects = $this->objectModel->saveExportTemplate($module);
if(dao::isError()) return dao::getError();
return $objects;
}
public function setPathNameTest($fileID, $extension)
{
$objects = $this->objectModel->setPathName($fileID, $extension);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* 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;
}
public function setImgSizeTest($content, $maxSize = 0)
{
$objects = $this->objectModel->setImgSize($content, $maxSize = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function replaceFileTest($fileID, $postName = 'upFile')
{
$objects = $this->objectModel->replaceFile($fileID, $postName = 'upFile');
if(dao::isError()) return dao::getError();
return $objects;
}
public function cropImageTest($rawImage, $target, $x, $y, $width, $height, $resizeWidth = 0, $resizeHeight = 0)
{
$objects = $this->objectModel->cropImage($rawImage, $target, $x, $y, $width, $height, $resizeWidth = 0, $resizeHeight = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function pasteImageTest($data, $uid = '', $safe = false)
{
$objects = $this->objectModel->pasteImage($data, $uid = '', $safe = false);
if(dao::isError()) return dao::getError();
return $objects;
}
public function parseCSVTest($fileName)
{
$objects = $this->objectModel->parseCSV($fileName);
if(dao::isError()) return dao::getError();
return $objects;
}
public function processImgURLTest($data, $editorList, $uid = '')
{
$objects = $this->objectModel->processImgURL($data, $editorList, $uid = '');
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* 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;
}
public function imagecreatefrombmpTest($filename)
{
$objects = $this->objectModel->imagecreatefrombmp($filename);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* 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;
}
public function replaceImgURLTest($data, $fields)
{
$objects = $this->objectModel->replaceImgURL($data, $fields);
if(dao::isError()) return dao::getError();
return $objects;
}
public function sendDownHeaderTest($fileName, $fileType, $content, $type = 'content')
{
$objects = $this->objectModel->sendDownHeader($fileName, $fileType, $content, $type = 'content');
if(dao::isError()) return dao::getError();
return $objects;
}
public function getImageSizeTest($file)
{
$objects = $this->objectModel->getImageSize($file);
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;
}
}
+131
View File
@@ -0,0 +1,131 @@
<?php
class gitTest
{
public $tester;
public function __construct()
{
global $tester;
$this->tester = $tester;
$this->gitModel = $this->tester->loadModel('git');
}
/**
* Run
*
* @access public
* @return void
*/
public function run()
{
return $this->gitModel->run();
}
/**
* Update commit.
*
* @param object $repo
* @param array $commentGroup
* @param bool $printLog
* @access public
* @return string
*/
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 mixed
*/
public function setRepos()
{
$this->gitModel->setRepos();
$repo = array_shift($this->gitModel->repos);
return $repo;
}
/**
* Get repos.
*
* @access public
* @return array
*/
public function getRepos()
{
$pairs = $this->gitModel->getRepos();
return array_shift($pairs);
}
/**
* Set repo.
*
* @param object $repo
* @access public
* @return bool
*/
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 mixed
*/
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
* @param int $fromRevision
* @access public
* @return array
*/
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;
}
}
+280
View File
@@ -0,0 +1,280 @@
<?php
class holidayTest
{
public function __construct()
{
global $tester;
$this->objectModel = $tester->loadModel('holiday');
}
/**
* Test getById method.
*
* @param string $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);
}
public function getWorkingDaysTest($begin = '', $end = '')
{
$objects = $this->objectModel->getWorkingDays($begin, $end);
if(dao::isError()) return dao::getError();
return count($objects);
}
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 string $beginDate
* @param string $endDate
* @access public
* @return object
*/
public function updateProgramPlanDurationTest($beginDate, $endDate)
{
$objects = $this->objectModel->updateProgramPlanDuration($beginDate, $endDate);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* Test updateProjectRealDuration method.
*
* @param string $beginDate
* @param string $endDate
* @access public
* @return object
*/
public function updateProjectRealDurationTest($beginDate, $endDate)
{
$objects = $this->objectModel->updateProjectRealDuration($beginDate, $endDate);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* Test updateTaskPlanDuration method.
*
* @param string $beginDate
* @param string $endDate
* @access public
* @return object
*/
public function updateTaskPlanDurationTest($beginDate, $endDate)
{
$objects = $this->objectModel->updateTaskPlanDuration($beginDate, $endDate);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* Test updateTaskRealDuration method.
*
* @param string $beginDate
* @param string $endDate
* @access public
* @return object
*/
public function updateTaskRealDurationTest($beginDate, $endDate)
{
$objects = $this->objectModel->updateTaskRealDuration($beginDate, $endDate);
if(dao::isError()) return dao::getError();
return $objects;
}
}
+122
View File
@@ -0,0 +1,122 @@
<?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;
}
}
+126
View File
@@ -0,0 +1,126 @@
<?php
class settingTest
{
public function __construct()
{
global $tester;
$this->objectModel = $tester->loadModel('setting');
}
public function getItemTest($paramString)
{
$objects = $this->objectModel->getItem($paramString);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getItemsTest($paramString)
{
$objects = $this->objectModel->getItems($paramString);
if(dao::isError()) return dao::getError();
return $objects;
}
public function setItemTest($path, $value = '')
{
$objects = $this->objectModel->setItem($path, $value = '');
if(dao::isError()) return dao::getError();
return $objects;
}
public function setItemsTest($path, $items)
{
$objects = $this->objectModel->setItems($path, $items);
if(dao::isError()) return dao::getError();
return $objects;
}
public function deleteItemsTest($paramString)
{
$objects = $this->objectModel->deleteItems($paramString);
if(dao::isError()) return dao::getError();
return $objects;
}
public function parseItemParamTest($paramString)
{
$objects = $this->objectModel->parseItemParam($paramString);
if(dao::isError()) return dao::getError();
return $objects;
}
public function createDAOTest($params, $method = 'select')
{
$objects = $this->objectModel->createDAO($params, $method = 'select');
if(dao::isError()) return dao::getError();
return $objects;
}
public function getSysAndPersonalConfigTest($account = '')
{
$objects = $this->objectModel->getSysAndPersonalConfig($account = '');
if(dao::isError()) return dao::getError();
return $objects;
}
public function getVersionTest()
{
$objects = $this->objectModel->getVersion();
if(dao::isError()) return dao::getError();
return $objects;
}
public function getURSRTest()
{
$objects = $this->objectModel->getURSR();
if(dao::isError()) return dao::getError();
return $objects;
}
public function updateVersionTest($version)
{
$objects = $this->objectModel->updateVersion($version);
if(dao::isError()) return dao::getError();
return $objects;
}
public function setSNTest()
{
$objects = $this->objectModel->setSN();
if(dao::isError()) return dao::getError();
return $objects;
}
public function snNeededUpdateTest($sn)
{
$objects = $this->objectModel->snNeededUpdate($sn);
if(dao::isError()) return dao::getError();
return $objects;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?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;
}
}
+228 -24
View File
@@ -4,26 +4,91 @@ class weeklyTest
public function __construct()
{
global $tester;
$this->objectModel = $tester->loadModel('weekly');
$this->objectModel = $tester->loadModel('weekly');
$this->projectModel = $tester->loadModel('project');
}
public function getPageNavTest($project, $date)
/**
* GetPageNav
*
* @param int $projectID
* @param string $date
* @access public
* @return string
*/
public function getPageNavTest($projectID, $date)
{
$objects = $this->objectModel->getPageNav($project, $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;
}
public function getWeekPairsTest($begin, $end = '')
{
$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)
{
@@ -34,15 +99,34 @@ class weeklyTest
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();
return $objects;
$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);
@@ -52,6 +136,14 @@ class weeklyTest
return $objects;
}
/**
* Get monday for a date.
*
* @param string $date
* @access public
* @return date
*/
public function getThisMondayTest($date)
{
$objects = $this->objectModel->getThisMonday($date);
@@ -61,6 +153,14 @@ class weeklyTest
return $objects;
}
/**
* GetThisSunday
*
* @param string $date
* @access public
* @return date
*/
public function getThisSundayTest($date)
{
$objects = $this->objectModel->getThisSunday($date);
@@ -70,6 +170,14 @@ class weeklyTest
return $objects;
}
/**
* GetLastDay
*
* @param string $date
* @access public
* @return string
*/
public function getLastDayTest($date)
{
$objects = $this->objectModel->getLastDay($date);
@@ -79,87 +187,167 @@ class weeklyTest
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 = '');
$objects = $this->objectModel->getStaff($project, $date);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getFinishedTest($project, $date = '', $pager = null)
/**
* Test getFinished
*
* @param int $project
* @param string $date
* @access public
* @return void
*/
public function getFinishedTest($project, $date = '')
{
$objects = $this->objectModel->getFinished($project, $date = '', $pager = null);
$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 = '');
$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 = '');
$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 = '');
$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 = '');
$objects = $this->objectModel->getPlanedTaskByWeek($project, $date);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* Test getPV
*
* @param int $project
* @param string $date
* @access public
* @return int
*/
public function getPVTest($projectID, $date = '')
{
$objects = $this->objectModel->getPV($projectID, $date = '');
$objects = $this->objectModel->getPV($projectID, $date);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* Test get EV data.
*
* @param int $projectID
* @param string $date
* @access public
* @return int
*/
public function getEVTest($projectID, $date = '')
{
$objects = $this->objectModel->getEV($projectID, $date = '');
$objects = $this->objectModel->getEV($projectID, $date);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* 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 = '');
$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);
@@ -169,6 +357,14 @@ class weeklyTest
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);
@@ -178,12 +374,20 @@ class weeklyTest
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 = 'progress', $data = 0);
$objects = $this->objectModel->getTips($type, $data);
if(dao::isError()) return dao::getError();
return $objects;
}
}
}
+111
View File
@@ -0,0 +1,111 @@
title: table zt_extension
desc: "插件"
author: automated export
version: "1.0"
fields:
- field: id
note: "ID"
range: 1-10000
prefix: ""
postfix: ""
loop: 0
format: ""
- field: name
note: "插件名称"
range: 1-10000
prefix: "这是插件名称"
postfix: ""
loop: 0
format: ""
- field: code
note: "代号"
range: 1-10000
prefix: "code"
postfix: ""
loop: 0
format: ""
- field: version
note: "版本号"
range: 1-3
prefix: "version"
postfix: ""
loop: 0
format: ""
- field: author
note: "作者"
range: 1-10000
prefix: "author"
postfix: ""
loop: 0
format: ""
- field: desc
note: "描述"
range: 1-10000
prefix: "这是插件描述"
postfix: ""
loop: 0
format: ""
- field: license
note: "授权"
range: LGPL
prefix: ""
postfix: ""
loop: 0
format: ""
- field: type
note: "类型"
range: extension
prefix: ""
postfix: ""
loop: 0
format: ""
- field: site
note: "官网"
range: zentao
prefix: "http://"
postfix: ".net"
loop: 0
format: ""
- field: zentaoCompatible
note: "适用版本"
range: all
prefix: ""
postfix: ""
loop: 0
format: ""
- field: installedTime
note: "安装时间"
from: common.date.v1.yaml
use: dateA
prefix: ""
postfix: ""
loop: 0
format: ""
- field: depends
note: "依赖"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: dirs
note: "安装目录"
range: []
prefix: ""
postfix: ""
loop: 0
format: ""
- field: files
note: "安装文件"
range: 1-10000
prefix: "json格式文件内容"
postfix: ""
loop: 0
format: ""
- field: status
note: "安装状态"
range: installed,deactivated
prefix: ""
postfix: ""
loop: 0
format: ""
+6
View File
@@ -41,6 +41,12 @@ fields:
- field: engine
note: "引擎"
range: jenkins,gitlab
- field: server
note: "服务器ID"
range: 3,1
- field: pipeline
note: "流水线"
range: dave,[{"project":"1569"}]
- field: triggerType
note: "触发方式"
range: tag,commit,schedule
+68
View File
@@ -0,0 +1,68 @@
title: table zt_log
desc: "接口日志"
author: automated export
version: "1.0"
fields:
- field: id
note: "ID"
range: 1-10000
prefix: ""
postfix: ""
loop: 0
format: ""
- field: objectType
note: "对象类型"
range: entry,webhook{9}
prefix: ""
postfix: ""
loop: 0
format: ""
- field: objectID
note: "对象ID"
range: 1-10000
prefix: ""
postfix: ""
loop: 0
format: ""
- field: action
note: "操作日志ID"
range: 1-10000
prefix: ""
postfix: ""
loop: 0
format: ""
- field: date
note: "日期"
range: "(-1M)-(1w)"
type: timestamp
format: "YYYY-MM-DD hh:mm:ss"
prefix: ""
postfix: ""
- field: url
note: "请求地址"
range: "qcmmi"
prefix: "http://"
postfix: ".com"
loop: 0
format: ""
- field: contentType
note: "内容类型"
range: "application/json"
prefix: ""
postfix: ""
loop: 0
format: ""
- field: data
note: "数据"
range: a-z
prefix: ""
postfix: ""
loop: 0
format: ""
- field: result
note: "结果"
range: a-z
prefix: ""
postfix: ""
loop: 0
format: ""
+83
View File
@@ -0,0 +1,83 @@
title: table_meeting
desc: ""
version: "1.0"
fields:
- field: id
range: 1-1000
- field: project
range: 11-20
- field: execution
range: 101-110
- field: name
range: 1-100
prefix: "会议"
- field: type
range: ""
- field: begin
range: "(-1M)-(+1w)"
type: timestamp
format: "hh:mm:ss"
- field: end
range: "(-1M)-(+1w):1h"
type: timestamp
format: "hh:mm:ss"
- field: dept
range: 1-10
- field: mode
range: both,online,outline
- field: host
range: admin
- field: participant
range: admin
prefix: ","
postfix: ","
- field: date
range: "(-1M)-(+1w)"
type: timestamp
format: "YYYY-MM-DD"
- field: room
range: 1
- field: minutes
range: ""
- field: minutedBy
range: ""
- field: minutedDate
range: ""
- field: objectType
range: story,task,issue,bug
- field: objectID
range: 0
- field: createdBy
range: admin
- field: createdDate
range: "(-1M)-(+1w)"
type: timestamp
format: "YYYY-MM-DD hh:mm:ss"
- field: editedBy
range: ""
- field: editedDate
range: ""
- field: deleted
range: 0
+4
View File
@@ -28,5 +28,9 @@ fields:
range: 0
- field: compileID
range: 0
- field: createdBy
range: admin
- field: assignee
range: admin
- field: deleted
range: 0
+98
View File
@@ -0,0 +1,98 @@
title: table zt_notify
desc: "消息通知"
author: automated export
version: "1.0"
fields:
- field: id
note: "ID"
range: 1-10000
prefix: ""
postfix: ""
loop: 0
format: ""
- field: objectType
note: "对象类型"
range: mail
prefix: ""
postfix: ""
loop: 0
format: ""
- field: objectID
note: "对象ID"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: action
note: "操作记录ID"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: toList
note: "指派用户"
range: admin,user10,test10,dev10,top10
prefix: ""
postfix: ""
loop: 0
format: ""
- field: ccList
range: 0
note: ""
prefix: ""
postfix: ""
loop: 0
format: ""
- field: subject
note: "主题"
range: 1-100
prefix: "主题"
postfix: ""
loop: 0
format: ""
- field: data
note: "记录数据"
range: 1-100
prefix: "用户创建了任务"
postfix: ""
loop: 0
format: ""
- field: createdBy
note: "创建者"
range: dev12,test12,admin
prefix: ""
postfix: ""
loop: 0
format: ""
- field: createdDate
note: "创建日期"
range: "(1M)-(1w)"
type: timestamp
format: "YYYY-MM-DD hh:mm:ss"
prefix: ""
postfix: ""
loop: 0
- field: sendTime
note: "发送日期"
range: "(1M)-(1w)"
type: timestamp
format: "YYYY-MM-DD hh:mm:ss"
prefix: ""
postfix: ""
loop: 0
- field: status
note: "状态"
range: wait,fail
prefix: ""
postfix: ""
loop: 0
format: ""
- field: failReason
note: "失败原因"
range: ""
prefix: ""
postfix: ""
loop: 0
format: ""
+9 -9
View File
@@ -3,24 +3,24 @@ author: Zeng gang
version: "1.0"
fields:
- field: id
range: 1-2
range: 1-3
- field: type
range: gitlab,sonarqube
range: gitlab,sonarqube,jenkins
- field: name
range: gitlab服务器,sonarqube服务器
range: gitlab服务器,sonarqube服务器,jenkins服务器
- field: url
range: [http://192.168.1.161:51080],[http://192.168.1.161:59001]
range: [http://10.0.1.161:51080],[http://10.0.1.161:59001],[http://10.0.1.161:58080]
- field: account
range: [],[admin]
range: [],[admin]{2}
- field: password
range: [],[UDJzc3cwcmQ=]
range: [],[UDJzc3cwcmQ=],[]
- field: token
range: x88fZokrp5hShia2jyBN,YWRtaW46UDJzc3cwcmQ=
range: x88fZokrp5hShia2jyBN,YWRtaW46UDJzc3cwcmQ=,1196c85ba525a268570df9da627e3a7b2d
- field: private
range: 08bcc98f75d7d40053dc80722bdc117b,228b25587479f2fc7570428e8bcbabdc
range: 08bcc98f75d7d40053dc80722bdc117b,228b25587479f2fc7570428e8bcbabdc,ec8e41481723685d9106c88be5967c41
- field: createdBy
range: admin
- field: createdDate
range: [2021-12-09 11:23:35],[2022-01-12 08:47:37]
range: [2021-12-09 11:23:35],[2022-01-12 08:47:37],[2022-01-12 08:47:37]
- field: deleted
range: 0
+4
View File
@@ -62,5 +62,9 @@ fields:
- field: subStatus
range: ' '
- field: notify
range: PO,PD
postfix: ","
- field: deleted
range: 0
+7 -2
View File
@@ -50,14 +50,14 @@ fields:
- field: commiter
note: "源代码帐号"
fields:
- field: commiter1
- field: commiter1
range: admin,user{99},test{100},dev{100},pm{100},po{100},td{100},pd{100},qd{100},top{100},outside{100},others{100},a,bb,ccc,qwuiadsd?!2as@#%$aasd~aj1!@#1
- field: commiter2
range: [],1-99,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,[]{4}
- field: avatar
note: ""
fields:
- field: avatar1
- field: avatar1
range: /home/z/tmp/,/home/z/user/
- field: avatar2
range: 1-10,10-20
@@ -167,6 +167,11 @@ fields:
range: 1
- field: ranzhi
note: "ZDOO账号"
fields:
- field: account1
range: admin,user{99},test{100},dev{100},pm{100},po{100},td{100},pd{100},qd{100},top{100},outside{100},others{100},a,bb,ccc,qwuiadsd?!2as@#%$aasd~aj1!@#1
- field: account2
range: [],1-99,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,[]{4}
- field: score
note: "积分"
range: 1-10000:R
+47
View File
@@ -0,0 +1,47 @@
title: table zt_usertpl
desc: "用户模块"
author: automated export
version: "1.0"
fields:
- field: id
note: "ID"
range: 1-10000
prefix: ""
postfix: ""
loop: 0
format: ""
- field: account
range: admin,dev10,top10,test10,po10
note: "用户名"
prefix: ""
postfix: ""
loop: 0
format: ""
- field: type
note: "类型"
range: task,story,bug,exportstory
prefix: ""
postfix: ""
loop: 0
format: ""
- field: title
note: "模板名"
range: 1-10000
prefix: "模板名称"
postfix: ""
loop: 0
format: ""
- field: content
note: "内容"
range: 1-10000
prefix: "模块内容"
postfix: ""
loop: 0
format: ""
- field: public
note: "是否公开"
range: 0,1
prefix: ""
postfix: ""
loop: 0
format: ""
+2 -4
View File
@@ -21,10 +21,8 @@ fields:
format: ""
- field: weekStart
note: ""
range: "(M)-(w):60s"
type: timestamp
format: "YYYY-MM-DD"
prefix: ""
range: ""
prefix: "2022-05-02"
postfix: ""
- field: pv
range: 1-10
+7 -2
View File
@@ -13,7 +13,8 @@ $builder->dept = array('rows' => 100, 'extends' => array('dept'));
$builder->action = array('rows' => 100, 'extends' => array('action'));
$builder->history = array('rows' => 100, 'extends' => array('history'));
$builder->file = array('rows' => 100, 'extends' => array('file'));
$builder->score = array('rows' => 100, 'extends' => array('score'));
$builder->score = array('rows' => 100, 'extends' => array('score'));
$builder->extension = array('rows' => 10, 'extends' => array('extension'));
$builder->program = array('rows' => 10, 'extends' => array('project', 'program'));
$builder->project = array('rows' => 90, 'extends' => array('project', 'project'));
@@ -103,14 +104,18 @@ $builder->designspec = array('rows' => 120, 'extends' => array('designspec'));
$builder->stage = array('rows' => 6, 'extends' => array('stage'));
$builder->webhook = array('rows' => 7, 'extends' => array('webhook'));
$builder->entry = array('rows' => 1, 'extends' => array('entry'));
$builder->log = array('rows' => 10, 'extends' => array('log'));
$builder->weeklyreport = array('rows' => 10, 'extends' => array('weeklyreport'));
$builder->metting = array('rows' => 10, 'extends' => array('meeting'));
$builder->usertpl = array('rows' => 10, 'extends' => array('usertpl'));
$builder->pipeline = array('rows' => 2, 'extends' => array('pipeline'));
$builder->pipeline = array('rows' => 3, 'extends' => array('pipeline'));
$builder->holiday = array('rows' => 100, 'extends' => array('holiday'));
$builder->repo = array('rows' => 1, 'extends' => array('repo'));
$builder->job = array('rows' => 2, 'extends' => array('job'));
$builder->mr = array('rows' => 1, 'extends' => array('mr'));
$builder->oauth = array('rows' => 90, 'extends' => array('oauth'));
$builder->notify = array('rows' => 10, 'extends' => array('notify'));
$builder->vm = array('rows' => 1, 'extends' => array('vm'));
$builder->vmtemplate = array('rows' => 1, 'extends' => array('vmtemplate'));
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/ci.class.php';
su('admin');
/**
title=测试 ciModel->setMenu();
cid=1
pid=1
替换devops模块的参数 >> 代码|repo|browse|repoID=1
*/
$ci = new ciTest();
r($ci->setMenuTest()) && p('link') && e('代码|repo|browse|repoID=1'); //替换devops模块导航的参数
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/ci.class.php';
su('admin');
/**
title=测试 ciModel->syncCompileStatus();
cid=1
pid=1
同步jenkins构建结果 >> created
*/
$ci = new ciTest();
r($ci->syncCompileStatusTest(1)) && p('status') && e('created'); //同步jenkins构建结果
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->buildBrowseSwitch();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->buildBrowseSwitchTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->buildCollectButton4Doc();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->buildCollectButton4DocTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->buildCreateButton4Doc();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->buildCreateButton4DocTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->buildCrumbTitle();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->buildCrumbTitleTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->checkAutoloadPage();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->checkAutoloadPageTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->checkPrivDoc();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->checkPrivDocTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->checkPrivLib();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->checkPrivLibTest()) && p() && e();
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->create();
cid=1
pid=1
创建产品文档 >> 1,新建产品文档
创建项目文档 >> 27,新建项目文档
创建执行文档 >> 127,新建执行文档
创建自定义文档 >> text,
创建url文档 >> url,www.baidu.com
创建Markdown文档 >> text,Markdown
创建私有文档 >> private
创建自定义文档 >> custom,1,2,3
不输入文档库 >> 『所属文档库』不能为空。
不输入标题 >> 『文档标题』不能为空。
*/
$libIDs = array('1', '117', '217', '821');
$type = array('text', 'url', 'execution', 'custom', '');
$acl = array('', 'open', 'custom', 'private');
$groups = array('1', '2', '3');
$users = array('admin', 'dev1', 'dev10');
$createProductDoc = array('lib' => $libIDs[0], 'title' => '新建产品文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$createProjectDoc = array('lib' => $libIDs[1], 'title' => '新建项目文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$createExecutionDoc = array('lib' => $libIDs[2], 'title' => '新建执行文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$createCustomDoc = array('lib' => $libIDs[3], 'title' => '新建自定义文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$createUrlDoc = array('lib' => $libIDs[0], 'title' => '新建URL文档', 'type' => $type[1], 'url' => 'www.baidu.com', 'acl' => $acl[1]);
$createMarkdownDoc = array('lib' => $libIDs[0], 'title' => '新建markdown文档', 'type' => $type[0], 'contentType' => 'markdown', 'contentMarkdown' => 'Markdown', 'acl' => $acl[1]);
$privateDoc = array('lib' => $libIDs[0], 'title' => '新建私有文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[3]);
$customDoc = array('lib' => $libIDs[0], 'title' => '新建自定义文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[2], 'groups' => $groups, 'users' => $users);
$noLib = array('title' => '无文档库', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$noTitle = array('lib' => $libIDs[0], 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$noType = array('lib' => $libIDs[0], 'title' => '无TYPE', 'contentType' => 'html', 'acl' => $acl[1]);
$doc = new docTest();
r($doc->createTest($createProductDoc)) && p('0:product,title') && e('1,新建产品文档'); //创建产品文档
r($doc->createTest($createProjectDoc)) && p('0:project,title') && e('27,新建项目文档'); //创建项目文档
r($doc->createTest($createExecutionDoc)) && p('0:execution,title') && e('127,新建执行文档'); //创建执行文档
r($doc->createTest($createCustomDoc)) && p('0:type,draft') && e('text,'); //创建自定义文档
r($doc->createTest($createUrlDoc)) && p('0:type,draft') && e('url,www.baidu.com'); //创建url文档
r($doc->createTest($createMarkdownDoc)) && p('0:type,draft') && e('text,Markdown'); //创建Markdown文档
r($doc->createTest($privateDoc)) && p('0:acl') && e('private'); //创建私有文档
r($doc->createTest($customDoc)) && p('0:acl,groups') && e('custom,1,2,3'); //创建自定义文档
r($doc->createTest($noLib)) && p('lib') && e('『所属文档库』不能为空。');//不输入文档库
r($doc->createTest($noTitle)) && p('title:0') && e('『文档标题』不能为空。'); //不输入标题
system("./ztest init");
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->createApiLib();
cid=1
pid=1
新建公有接口库 >> api;新建api文档库
新建私有接口库 >> private;www.zentaopms.com
新建自定义接口库 >> custom;1,2,3;admin,dev1,dev10
接口库名称为空 >> 『接口库名称』不能为空。
重复创建接口库 >> 『接口库名称』已经有『新建api文档库』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。
*/
$acl = array('', 'open', 'custom', 'private');
$groups = array('1', '2', '3');
$users = array('admin', 'dev1', 'dev10');
$openApilib = array('name' => '新建api文档库', 'acl' => $acl[1], 'baseUrl' => 'www.zentaopms.com');
$privateApilib = array('name' => '新建私有api文档库', 'acl' => $acl[3], 'baseUrl' => 'www.zentaopms.com');
$customApilib = array('name' => '新建自定义api文档库', 'acl' => $acl[2], 'baseUrl' => 'www.zentaopms.com', 'groups' => $groups, 'users' => $users);
$noName = array('name' => '', 'acl' => $acl[1], 'baseUrl' => 'www.zentaopms.com');
$noAcl = array('name' => '无权限', 'acl' => $acl[0], 'baseUrl' => 'www.zentaopms.com');
$noBaseUrl = array('name' => 'noBaseUrl', 'acl' => $acl[0], 'baseUrl' => '');
$doc = new docTest();
r($doc->createApiLibTest($openApilib)) && p('type;name') && e('api;新建api文档库'); //新建公有接口库
r($doc->createApiLibTest($privateApilib)) && p('acl;baseUrl') && e('private;www.zentaopms.com'); //新建私有接口库
r($doc->createApiLibTest($customApilib)) && p('acl;groups;users') && e('custom;1,2,3;admin,dev1,dev10');//新建自定义接口库
r($doc->createApiLibTest($noName)) && p('name:0') && e('『接口库名称』不能为空。'); //接口库名称为空
r($doc->createApiLibTest($noAcl)) && p('acl') && e(''); //接口库权限为空
r($doc->createApiLibTest($noBaseUrl)) && p('baseUrl') && e(''); //接口库地址为空
r($doc->createApiLibTest($openApilib)) && p('name:0') && e('『接口库名称』已经有『新建api文档库』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。');//重复创建接口库
system("./ztest init");
+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->createLib();
cid=1
pid=1
新建公有产品文档库 >> product;新建文档库
新建公有项目文档库 >> project;default
新建公有执行文档库 >> execution;rnd
新建公有自定义文档库 >> custom;0
新建私有自定义文档库 >> product;1,2,3;admin,dev1,dev10
新建无产品产品文档库 >> 『产品库』应当是数字。
新建无项目项目文档库 >> 『project』应当是数字。
新建无执行执行文档库 >> 『迭代库』应当是数字。
*/
$type = array('product', 'project', 'execution', 'custom', '');
$product = array('', '1');
$project = array('', '11');
$execution = array('', '101');
$name = array('', '新建文档库');
$acl = array('', 'default', 'custom');
$groups = array('1', '2', '3');
$users = array('admin', 'dev1', 'dev10');
$createProduct = array('type' => $type[0], 'product' => $product[1], 'name' => $name[1], 'acl' => $acl[1]);
$createProject = array('type' => $type[1], 'project' => $project[1], 'name' => $name[1], 'acl' => $acl[1]);
$createExecution = array('type' => $type[2], 'execution' => $execution[1], 'name' => $name[1], 'acl' => $acl[1]);
$createCustom = array('type' => $type[3], 'name' => $name[1], 'acl' => $acl[1]);
$customLib = array('type' => $type[0], 'product' => $product[1], 'name' => $name[1], 'acl' => $acl[2], 'groups' => $groups, 'users' => $users);
$noType = array('type' => $type[4], 'product' => $product[1], 'name' => $name[1], 'acl' => $acl[1]);
$noProduct = array('type' => $type[0], 'product' => $product[0], 'name' => $name[1], 'acl' => $acl[1]);
$noProject = array('type' => $type[1], 'project' => $project[0], 'name' => $name[1], 'acl' => $acl[1]);
$noExecution = array('type' => $type[2], 'execution' => $execution[0], 'name' => $name[1], 'acl' => $acl[1]);
$noAcl = array('type' => $type[0], 'product' => $product[1], 'name' => $name[1], 'acl' => $acl[0]);
$doc = new docTest();
r($doc->createLibTest($createProduct)) && p('type;name') && e('product;新建文档库'); //新建公有产品文档库
r($doc->createLibTest($createProject)) && p('type;acl') && e('project;default'); //新建公有项目文档库
r($doc->createLibTest($createExecution)) && p('type;vision') && e('execution;rnd'); //新建公有执行文档库
r($doc->createLibTest($createCustom)) && p('type;project') && e('custom;0'); //新建公有自定义文档库
r($doc->createLibTest($customLib)) && p('type;groups;users') && e('product;1,2,3;admin,dev1,dev10');//新建私有自定义文档库
r($doc->createLibTest($noType)) && p('type') && e(''); //新建无类型文档库
r($doc->createLibTest($noProduct)) && p('product:0') && e('『产品库』应当是数字。'); //新建无产品产品文档库
r($doc->createLibTest($noProject)) && p('project:0') && e('『project』应当是数字。'); //新建无项目项目文档库
r($doc->createLibTest($noExecution)) && p('execution:0') && e('『迭代库』应当是数字。'); //新建无执行执行文档库
r($doc->createLibTest($noAcl)) && p('acl') && e(''); //新建无权限控制文档库
system("./ztest init");
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->extractKETableCSS();
cid=1
pid=1
*/
global $tester;
$doc = $tester->loadModel('doc');
$content = 'test';
$css = '<table class="ke-table1" style="width:100%;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">';
r($doc->extractKETableCSS($content)) && p() && e('0'); //未过滤数据查询
r($doc->extractKETableCSS($css)) && p() && e('.ke-table1{border:1px #000000 solid}');//过滤后数据查询
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->fillDocsInTree();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->fillDocsInTreeTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getAllLibGroups();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getAllLibGroupsTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getAllLibsByType();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getAllLibsByTypeTest()) && p() && e();
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getApiLibs();
cid=1
pid=1
查询全部接口库 >> api
查询额外的产品库 >> product
查询接口库 >> 接口库
查询全部接口库统计 >> 10
查询额外的产品库统计 >> 11
查询接口库统计 >> 10
*/
global $tester;
$doc = $tester->loadModel('doc');
$docLibIDList = array('0', '17', '901');
r($doc->getApiLibs($docLibIDList[0])) && p('901:type') && e('api'); //查询全部接口库
r($doc->getApiLibs($docLibIDList[1])) && p('17:type') && e('product');//查询额外的产品库
r($doc->getApiLibs($docLibIDList[2])) && p('902:name') && e('接口库'); //查询接口库
r(count($doc->getApiLibs($docLibIDList[0]))) && p() && e('10'); //查询全部接口库统计
r(count($doc->getApiLibs($docLibIDList[1]))) && p() && e('11'); //查询额外的产品库统计
r(count($doc->getApiLibs($docLibIDList[2]))) && p() && e('10'); //查询接口库统计
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getApiModuleTree();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getApiModuleTreeTest()) && p() && e();
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 docModel->getById();
cid=1
pid=1
*/
global $tester;
$doc = $tester->loadModel('doc');
$docIDList = array('0', '17', '1');
$versionList = array('0', '1', '2');
r($doc->getById($docIDList[1], $versionList[0])) && p('product;title') && e('17;文档标题17'); //正常根据id查询doc
r($doc->getById($docIDList[0], $versionList[0])) && p() && e('0'); //查询不存在的doc
r($doc->getById($docIDList[2], $versionList[1])) && p('version;content') && e('2;文档正文1'); //查询版本为1的文档内容
r($doc->getById($docIDList[2], $versionList[2])) && p('version;content') && e('2;文档正文901'); //查询版本为2的文档内容
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 docModel->getByIdList();
cid=1
pid=1
*/
global $tester;
$doc = $tester->loadModel('doc');
$docIDList = array('0', '117', '1', '217');
r($doc->getByIdList($docIDList)) && p('901:lib,content') && e('1,文档正文901');//正常查询文档库下的文档
r(count($doc->getByIdList($docIDList))) && p() && e('3'); //查询文档库下的文档统计
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getDocMenu();
cid=1
pid=1
*/
global $tester;
$doc = $tester->loadModel('doc');
$docIDList = array('0', '17');
$parents = array('0', '3637');
$orderBy = array('name_asc', 'id_desc');
$browseTypes = array('collectedbyme', '');
r($doc->getDocMenu($docIDList[1], $parents[0], $orderBy[0], $browseTypes[1])) && p('3637:name,parent') && e('目录17,0'); //无子目录查询
r($doc->getDocMenu($docIDList[1], $parents[1], $orderBy[0], $browseTypes[1])) && p('3754:name,parent') && e('子目录34,3637');//有子目录查询
r(count($doc->getDocMenu($docIDList[1], $parents[1], $orderBy[0], $browseTypes[1]))) && p() && e('2'); //子目录查询统计
r($doc->getDocMenu($docIDList[0], $parents[0], $orderBy[0], $browseTypes[0])) && p() && e('0'); //无效数据查询
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 docModel->getDocs();
cid=1
pid=1
正常获取文档库下的文档 >> 1,文档标题1
获取文档目录下的文档 >> 2,3622
libID为空查询 >> 900
*/
global $tester;
$doc = $tester->loadModel('doc');
$libIDlist = array('1', '2', '');
$moduleIDList = array('0','3621', '3622');
$orderBy = 'id_desc';
r($doc->getDocs($libIDlist[0], $moduleIDList[0], $orderBy)) && p('1:lib,title') && e('1,文档标题1');//正常获取文档库下的文档
r($doc->getDocs($libIDlist[1], $moduleIDList, $orderBy)) && p('2:lib,module') && e('2,3622'); //获取文档目录下的文档
r(count($doc->getDocs($libIDlist[2], $moduleIDList[0], $orderBy))) && p() && e('900'); //libID为空查询
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getDocsByBrowseType();
cid=1
pid=1
all类型查询 >> 1,文档标题1
openedbyme类型查询 >> 2,正常产品2
editedbyme类型查询 >> 0
byediteddate类型查询 >> 900,admin
collectedbyme类型查询 >> 0
test类型查询 >> 0
加上moduleId查询 >> 关键词1
all类型查询 >> 900
openedbyme类型查询 >> 900
byediteddate类型查询 >> 900
*/
$browseType = array('all', 'openedbyme', 'editedbyme', 'byediteddate', 'collectedbyme', 'test');
$moduleIds = array('', '3621', '3622', '3623');
$doc = new docTest();
r($doc->getDocsByBrowseTypeTest($browseType[0], $moduleIds[0])) && p('1:lib,title') && e('1,文档标题1');//all类型查询
r($doc->getDocsByBrowseTypeTest($browseType[1], $moduleIds[0])) && p('2:lib,objectName') && e('2,正常产品2');//openedbyme类型查询
r($doc->getDocsByBrowseTypeTest($browseType[2], $moduleIds[0])) && p() && e('0'); //editedbyme类型查询
r($doc->getDocsByBrowseTypeTest($browseType[3], $moduleIds[0])) && p('900:lib,users') && e('900,admin'); //byediteddate类型查询
r($doc->getDocsByBrowseTypeTest($browseType[4], $moduleIds[0])) && p() && e('0'); //collectedbyme类型查询
r($doc->getDocsByBrowseTypeTest($browseType[5], $moduleIds[0])) && p() && e('0'); //test类型查询
r($doc->getDocsByBrowseTypeTest($browseType[3], $moduleIds)) && p('1:keywords') && e('关键词1'); //加上moduleId查询
r(count($doc->getDocsByBrowseTypeTest($browseType[0], $moduleIds[0]))) && p('1:lib,title') && e('900'); //all类型查询
r(count($doc->getDocsByBrowseTypeTest($browseType[1], $moduleIds[0]))) && p('2:lib,objectName') && e('900'); //openedbyme类型查询
r(count($doc->getDocsByBrowseTypeTest($browseType[3], $moduleIds[0]))) && p('900:lib,users') && e('900'); //byediteddate类型查询
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getDocTree();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getDocTreeTest()) && p() && e();
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getExecutionModulePairs();
cid=1
pid=1
正常查询 >> 子目录200
正常查询统计 >> 4520
*/
global $tester;
$doc = $tester->loadModel('doc');
r($doc->getExecutionModulePairs()) && p('3920') && e('子目录200');//正常查询
r(count($doc->getExecutionModulePairs())) && p() && e('4520'); //正常查询统计
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getFileIcon();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getFileIconTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getFileSourcePairs();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getFileSourcePairsTest()) && p() && e();
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 docModel->getLibById();
cid=1
pid=1
正常查询文档库 >> 产品主库
查询不存在的文档库 >> 0
*/
global $tester;
$doc = $tester->loadModel('doc');
$docLibIDList = array('0', '17');
r($doc->getLibById($docLibIDList[1])) && p('name') && e('产品主库');//正常查询文档库
r($doc->getLibById($docLibIDList[0])) && p() && e('0'); //查询不存在的文档库
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getLibFiles();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getLibFilesTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getLibIdListByProject();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getLibIdListByProjectTest()) && p() && e();
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getLibs();
cid=1
pid=1
全部文档库查询 >> 产品主库
api文档库查询 >> 0
产品文档库查询 >> 产品主库
项目文档库查询 >> 项目主库
执行文档库查询 >> 迭代主库
产品文档库关联查询 >> 正常产品1 / 产品主库
notdoc查询 >> 产品主库
额外文档库查询 >> 产品主库
产品单独查询 >> 产品主库
项目单独查询 >> 项目主库
执行单独查询 >> 迭代主库
全部文档库查询统计 >> 900
产品文档库查询统计 >> 100
项目文档库查询统计 >> 90
执行文档库查询统计 >> 630
产品文档库关联查询统计 >> 900
notdoc查询统计 >> 900
额外文档库查询统计 >> 2
产品单独查询统计 >> 1
项目单独查询统计 >> 1
执行单独查询统计 >> 1
*/
global $tester;
$doc = $tester->loadModel('doc');
$types = array('all', 'api', 'product', 'project', 'execution');
$extra = array('', 'withObject', 'notdoc');
$appendLibs = array('17', '1');
$objectIDs = array('1', '11', '101', '0');
//var_dump($doc->getLibs($types[4], $extra[0], '', $objectIDs[2]));die;
r($doc->getLibs($types[0], $extra[0], '', $objectIDs[3])) && p('1') && e('产品主库'); //全部文档库查询
r($doc->getLibs($types[1], $extra[0], '', $objectIDs[3])) && p() && e('0'); //api文档库查询
r($doc->getLibs($types[2], $extra[0], '', $objectIDs[3])) && p('10') && e('产品主库'); //产品文档库查询
r($doc->getLibs($types[3], $extra[0], '', $objectIDs[3])) && p('110') && e('项目主库'); //项目文档库查询
r($doc->getLibs($types[4], $extra[0], '', $objectIDs[3])) && p('200') && e('迭代主库'); //执行文档库查询
r($doc->getLibs($types[0], $extra[1], '', $objectIDs[3])) && p('1') && e('正常产品1 / 产品主库');//产品文档库关联查询
r($doc->getLibs($types[0], $extra[2], '', $objectIDs[3])) && p('1') && e('产品主库'); //notdoc查询
r($doc->getLibs($types[1], $extra[0], $appendLibs, $objectIDs[3])) && p('1') && e('产品主库'); //额外文档库查询
r($doc->getLibs($types[2], $extra[0], '', $objectIDs[0])) && p('1') && e('产品主库'); //产品单独查询
r($doc->getLibs($types[3], $extra[0], '', $objectIDs[1])) && p('101') && e('项目主库'); //项目单独查询
r($doc->getLibs($types[4], $extra[0], '', $objectIDs[2])) && p('191') && e('迭代主库'); //执行单独查询
r(count($doc->getLibs($types[0], $extra[0], '', $objectIDs[3]))) && p() && e('900');//全部文档库查询统计
r(count($doc->getLibs($types[2], $extra[0], '', $objectIDs[3]))) && p() && e('100');//产品文档库查询统计
r(count($doc->getLibs($types[3], $extra[0], '', $objectIDs[3]))) && p() && e('90'); //项目文档库查询统计
r(count($doc->getLibs($types[4], $extra[0], '', $objectIDs[3]))) && p() && e('630');//执行文档库查询统计
r(count($doc->getLibs($types[0], $extra[1], '', $objectIDs[3]))) && p() && e('900');//产品文档库关联查询统计
r(count($doc->getLibs($types[0], $extra[2], '', $objectIDs[3]))) && p() && e('900');//notdoc查询统计
r(count($doc->getLibs($types[1], $extra[0], $appendLibs, $objectIDs[3]))) && p() && e('2'); //额外文档库查询统计
r(count($doc->getLibs($types[2], $extra[0], '', $objectIDs[0]))) && p() && e('1'); //产品单独查询统计
r(count($doc->getLibs($types[3], $extra[0], '', $objectIDs[1]))) && p() && e('1'); //项目单独查询统计
r(count($doc->getLibs($types[4], $extra[0], '', $objectIDs[2]))) && p() && e('1'); //执行单独查询统计
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getLibsByObject();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getLibsByObjectTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getLimitLibs();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getLimitLibsTest()) && p() && e();
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getObjectsByDoc();
cid=1
pid=1
*/
global $tester;
$doc = $tester->loadModel('doc');
$docIdList = array('17', '117', '217');
r($doc->getObjectsByDoc($docIdList)) && p('0:27;1:127;2:17') && e('项目17;迭代27;正常产品17');//查询文档库的项目产品迭代
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getOrderedObjects();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getOrderedObjectsTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getPreAndNextDoc();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getPreAndNextDocTest()) && p() && e();
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getPrivDocs();
cid=1
pid=1
查询单条doc >> 1
查询多条doc >> 1;2
查询模块doc >> 1;2
不传入libid查询统计 >> 900
*/
global $tester;
$doc = $tester->loadModel('doc');
$libIDlist = array('1', '2', '');
$moduleIDList = array('0','3621', '3622');
r($doc->getPrivDocs($libIDlist[0], $moduleIDList[0])) && p('1') && e('1'); //查询单条doc
r($doc->getPrivDocs($libIDlist, $moduleIDList[0])) && p('1;2') && e('1;2');//查询多条doc
r($doc->getPrivDocs($libIDlist, $moduleIDList)) && p('1;2') && e('1;2');//查询模块doc
r(count($doc->getPrivDocs($libIDlist[2], $moduleIDList[0]))) && p() && e('900');//不传入libid查询统计
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getPrivLibsByDoc();
cid=1
pid=1
正常查询 >> 900
正常查询统计 >> 600
*/
global $tester;
$doc = $tester->loadModel('doc');
r($doc->getPrivLibsByDoc()) && p('900') && e('900');//正常查询
r(count($doc->getPrivLibsByDoc())) && p() && e('600');//正常查询统计
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getProductCrumb();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getProductCrumbTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getStatisticInfo();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getStatisticInfoTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getSubLibGroups();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getSubLibGroupsTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getToAndCcList();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getToAndCcListTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->getTreeMenu();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->getTreeMenuTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->printChildModule();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->printChildModuleTest()) && p() && e();
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->saveDraft();
cid=1
pid=1
*/
$docIDList = array('17', '118', '217');
$content = array('content' => '测试');
$doc = new docTest();
r($doc->saveDraftTest($docIDList[0], $content)) && p('17:draft') && e('测试');//产品文档内容保存
r($doc->saveDraftTest($docIDList[1], $content)) && p('118:draft') && e('测试');//项目文档内容保存
r($doc->saveDraftTest($docIDList[2], $content)) && p('217:draft') && e('测试');//执行文档内容保存
r($doc->saveDraftTest($docIDList[0])) && p('17:draft') && e('测试');//文档无内容保存
system("./ztest init");
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->select();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->selectTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->setFastMenu();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->setFastMenuTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->setLibUsers();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->setLibUsersTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->setMenuByType();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->setMenuByTypeTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->statLibCounts();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->statLibCountsTest()) && p() && e();
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->summary();
cid=1
pid=1
*/
$doc = new docTest();
r($doc->summaryTest()) && p() && e();
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->update();
cid=1
pid=1
*/
$docID = array('1', '2', '3', '4', '5', '6', '7', '8');
$libIDs = array('1', '117', '217', '821');
$type = array('text', 'url', 'execution', 'custom', '');
$acl = array('', 'open', 'custom', 'private');
$groups = array('1', '2', '3');
$users = array('admin', 'dev1', 'dev10');
$updateProductDoc = array('lib' => $libIDs[0], 'title' => '修改产品文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$updateProjectDoc = array('lib' => $libIDs[1], 'title' => '修改项目文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$updateExecutionDoc = array('lib' => $libIDs[2], 'title' => '修改执行文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$updateCustomDoc = array('lib' => $libIDs[3], 'title' => '修改自定义文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$updateUrlDoc = array('lib' => $libIDs[0], 'title' => '修改URL文档', 'type' => $type[1], 'url' => 'www.baidu.com', 'acl' => $acl[1]);
$privateDoc = array('lib' => $libIDs[0], 'title' => '修改私有文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[3]);
$customDoc = array('lib' => $libIDs[0], 'title' => '修改自定义文档', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[2], 'groups' => $groups, 'users' => $users);
$noLib = array('title' => '无文档库', 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$noTitle = array('lib' => $libIDs[0], 'type' => $type[0], 'contentType' => 'html', 'acl' => $acl[1]);
$noType = array('lib' => $libIDs[0], 'title' => '无TYPE', 'contentType' => 'html', 'acl' => $acl[1]);
$doc = new docTest();
r($doc->updateTest($docID[0], $updateProductDoc)) && p('1:field,old,new') && e('title,文档标题901,修改产品文档');//修改为产品文档
r($doc->updateTest($docID[1], $updateProjectDoc)) && p('1:field,old,new') && e('module,3622,0'); //修改为项目文档
r($doc->updateTest($docID[2], $updateExecutionDoc)) && p('2:field,old,new') && e('title,文档标题903,修改执行文档');//修改为执行文档
r($doc->updateTest($docID[3], $updateCustomDoc)) && p('3:field,old,new') && e('keywords,关键词4,'); //修改为自定义文档
r($doc->updateTest($docID[4], $updateUrlDoc)) && p('4:field,old,new') && e('type,text,url'); //修改为url文档
r($doc->updateTest($docID[6], $privateDoc)) && p('6:field,old,new') && e('acl,open,private'); //修改为私有文档
r($doc->updateTest($docID[7], $customDoc)) && p('7:field,old,new') && e('groups,1,1,2,3'); //修改为自定义文档
r($doc->updateTest($docID[0], $noLib)) && p('0:field,old,new') && e('lib,1,'); //修改lib为空
r($doc->updateTest($docID[0], $noTitle)) && p('title:0') && e('『文档标题』不能为空。'); //修改标题为空
r($doc->updateTest($docID[0], $noType)) && p('2:field,old,new') && e('type,text,'); //修改type为空
system("./ztest init");
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->updateApiLib();
cid=1
pid=1
正常修改接口库 >> name,接口库,修改api文档库;baseUrl,,www.zentaopms.com;acl,private,open
修改users >> users,admin,test1
修改名字为空 >> 『接口库名称』不能为空。
修改成重复名称 >> 0
*/
$ids = array('901', '902');
$acl = array('', 'open', 'custom', 'private');
$groups = array('1', '2', '3');
$users = array('admin', 'dev1', 'dev10');
$openApilib = array('name' => '修改api文档库', 'baseUrl' => 'www.zentaopms.com', 'acl' => $acl[1], 'users' => 'admin', 'desc' => '');
$updateUsers = array('users' => 'test1');
$updateDesc = array('desc' => '修改详情');
$noName = array('name' => '');
$repeatName = array('name' => '修改api文档库');
$doc = new docTest();
r($doc->updateApiLibTest($ids[0], $openApilib)) && p('0:field,old,new;1:field,old,new;2:field,old,new') && e('name,接口库,修改api文档库;baseUrl,,www.zentaopms.com;acl,private,open');//正常修改接口库
r($doc->updateApiLibTest($ids[0], $updateUsers)) && p('0:field,old,new') && e('users,admin,test1'); //修改users
r($doc->updateApiLibTest($ids[0], $noName)) && p('name:0') && e('『接口库名称』不能为空。'); //修改名字为空
r($doc->updateApiLibTest($ids[0], $repeatName)) && p() && e('0'); //修改成重复名称
system("./ztest init");
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/doc.class.php';
su('admin');
/**
title=测试 docModel->updateLib();
cid=1
pid=1
正常修改产品文档库 >> type,product,project
正常修改项目文档库 >> project,27,11
正常修改执行文档库 >> product,0,1
正常修改自定义文档库 >> product,17,1
正常修改无type >> type,custom,
正常修改无产品 >> 『产品库』应当是数字。
正常修改无项目 >> 『project』应当是数字。』
正常修改无迭代 >> 『迭代库』应当是数字。
正常修改无文档库名 >> 『文档库名称』不能为空。
*/
$docLibIds = array('17', '117', '217');
$type = array('product', 'project', 'execution', 'custom', '');
$product = array('', '1');
$project = array('', '11');
$execution = array('', '101');
$name = array('', '新建文档库');
$acl = array('', 'default', 'custom');
$groups = array('1', '2', '3');
$users = array('admin', 'dev1', 'dev10');
$updateProduct = array('type' => $type[0], 'product' => $product[1], 'name' => $name[1], 'acl' => $acl[1]);
$updateProject = array('type' => $type[1], 'project' => $project[1], 'name' => $name[1], 'acl' => $acl[1]);
$updateExecution = array('type' => $type[2], 'execution' => $execution[1], 'name' => $name[1], 'acl' => $acl[1]);
$updateCustom = array('type' => $type[3], 'name' => $name[1], 'acl' => $acl[1]);
$customLib = array('type' => $type[0], 'product' => $product[1], 'name' => $name[1], 'acl' => $acl[2], 'groups' => $groups, 'users' => $users);
$noType = array('type' => $type[4], 'product' => $product[1], 'name' => $name[1], 'acl' => $acl[1]);
$noProduct = array('type' => $type[0], 'product' => $product[0], 'name' => $name[1], 'acl' => $acl[1]);
$noProject = array('type' => $type[1], 'project' => $project[0], 'name' => $name[1], 'acl' => $acl[1]);
$noExecution = array('type' => $type[2], 'execution' => $execution[0], 'name' => $name[1], 'acl' => $acl[1]);
$noName = array('type' => $type[0], 'product' => $product[1], 'name' => $name[0], 'acl' => $acl[0]);
$doc = new docTest();
r($doc->updateLibTest($docLibIds[0],$updateProject)) && p('0:field,old,new') && e('type,product,project'); //正常修改产品文档库
r($doc->updateLibTest($docLibIds[1],$updateProduct)) && p('1:field,old,new') && e('project,27,11'); //正常修改项目文档库
r($doc->updateLibTest($docLibIds[2],$updateExecution)) && p('2:field,old,new') && e('product,0,1'); //正常修改执行文档库
r($doc->updateLibTest($docLibIds[0],$updateCustom)) && p('1:field,old,new') && e('product,17,1'); //正常修改自定义文档库
r($doc->updateLibTest($docLibIds[0],$noType)) && p('0:field,old,new') && e('type,custom,'); //正常修改无type
r($doc->updateLibTest($docLibIds[0],$noProduct)) && p('product:0') && e('『产品库』应当是数字。'); //正常修改无产品
r($doc->updateLibTest($docLibIds[0],$noProject)) && p('project:0') && e('『project』应当是数字。』');//正常修改无项目
r($doc->updateLibTest($docLibIds[0],$noExecution)) && p('execution:0') && e('『迭代库』应当是数字。'); //正常修改无迭代
r($doc->updateLibTest($docLibIds[0],$noName)) && p('name:0') && e('『文档库名称』不能为空。'); //正常修改无文档库名
system("./ztest init");
@@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 extensionModel->checkDownloadPath();
cid=1
pid=1
*/
global $tester;
$result = $tester->loadModel('extension')->checkDownloadPath();
r(count($result)) && p() && e('2'); // 查看获取到的结果数量
r($result) && p('result') && e('ok'); // 查看获取到的结果
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 extensionModel->getInfoFromDB();
cid=1
pid=1
*/
global $tester;
$tester->loadModel('extension');
$ext1 = $tester->extension->getInfoFromDB('code1');
$ext2 = $tester->extension->getInfoFromDB('code2');
$ext3 = $tester->extension->getInfoFromDB('code3');
$ext4 = $tester->extension->getInfoFromDB('code4');
r($ext1) && p('id,name,code,type,status') && e('1,这是插件名称1,code1,extension,installed'); // 获取已安装的插件1的详细信息
r($ext2) && p('id,name,code,type,status') && e('2,这是插件名称2,code2,extension,deactivated'); // 获取已安装的插件2的详细信息
r($ext3) && p('id,name,code,type,status') && e('3,这是插件名称3,code3,extension,installed'); // 获取已安装的插件3的详细信息
r($ext4) && p('id,name,code,type,status') && e('4,这是插件名称4,code4,extension,deactivated'); // 获取已安装的插件4的详细信息
@@ -0,0 +1,22 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 extensionModel->getLocalExtensions();
cid=1
pid=1
*/
global $tester;
$tester->loadModel('extension');
$installedExt = $tester->extension->getLocalExtensions('installed');
$deactivatedExt = $tester->extension->getLocalExtensions('deactivated');
r(count($installedExt)) && p() && e('5'); // 获取已经安装的插件数量
r(count($deactivatedExt)) && p() && e('5'); // 获取已经销毁的插件数量
r($installedExt) && p('code1:id,name,type,status') && e('1,这是插件名称1,extension,installed'); // 获取代号为code1的插件详细信息
r($deactivatedExt) && p('code2:id,name,type,status') && e('2,这是插件名称2,extension,deactivated'); // 获取代号为code2的插件详细信息
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
su('admin');
/**
title=测试 extensionModel->getModulesByAPI();
cid=1
pid=1
*/
global $tester;
$api = $tester->loadModel('extension')->getModulesByAPI();
$includeUser = strpos($api, '个人相关') !== false;
$includeProject = strpos($api, '项目相关') !== false;
$includeMy = strpos($api, '地盘相关') !== false;
r($includeUser) && p() && e('1'); // 判断返回的API中是否包含个人相关
r($includeProject) && p() && e('1'); // 判断返回的API中是否包含项目相关
r($includeMy) && p() && e('0'); // 判断返回的API中是否包含地盘相关
+61
View File
@@ -0,0 +1,61 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->compressImage();
cid=1
pid=1
测试上传 png 文件 >> png,file.png,2038
测试上传 jpg 文件 >> jpg,file.jpg,1888573
测试上传 wri 文件 >> wri,这是一个文件名称6.wri,38624
测试上传 pdf 文件 >> pdf,这是一个文件名称7.pdf,25964
测试上传 ppt 文件 >> ppt,这是一个文件名称8.ppt,37248
*/
$pngFile = new stdclass();
$pngFile->extension = 'png';
$pngFile->pathname = '202205/06094008030126kf.png';
$pngFile->title = 'file.png';
$pngFile->size = '2038';
$pngFile->tmpname = '/tmp/php4dtXN0';
$jpgFile = new stdclass();
$jpgFile->extension = 'jpg';
$jpgFile->pathname = '202205/0609531806661fhm.jpg';
$jpgFile->title = 'file.jpg';
$jpgFile->size = '1888573';
$jpgFile->tmpname = '/tmp/phpt5IxrF';
$wriFile = new stdclass();
$wriFile->extension = 'wri';
$wriFile->pathname = '202006/0414225006610006.wri';
$wriFile->title = '这是一个文件名称6.wri';
$wriFile->size = '38624';
$wriFile->tmpname = '/tmp/php34948';
$pdfFile = new stdclass();
$pdfFile->extension = 'pdf';
$pdfFile->pathname = '202007/0414225006610007.pdf';
$pdfFile->title = '这是一个文件名称7.pdf';
$pdfFile->size = '25964';
$pdfFile->tmpname = '/tmp/php4h2k3';
$pptFile = new stdclass();
$pptFile->extension = 'ppt';
$pptFile->pathname = '202008/0414225006610008.ppt';
$pptFile->title = '这是一个文件名称8.ppt';
$pptFile->size = '37248';
$pptFile->tmpname = '/tmp/php7bhfki';
$file = new fileTest();
r($file->compressImageTest($pngFile)) && p('extension,title,size') && e('png,file.png,2038'); // 测试上传 png 文件
r($file->compressImageTest($jpgFile)) && p('extension,title,size') && e('jpg,file.jpg,1888573'); // 测试上传 jpg 文件
r($file->compressImageTest($wriFile)) && p('extension,title,size') && e('wri,这是一个文件名称6.wri,38624'); // 测试上传 wri 文件
r($file->compressImageTest($pdfFile)) && p('extension,title,size') && e('pdf,这是一个文件名称7.pdf,25964'); // 测试上传 pdf 文件
r($file->compressImageTest($pptFile)) && p('extension,title,size') && e('ppt,这是一个文件名称8.ppt,37248'); // 测试上传 ppt 文件
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->getById();
cid=1
pid=1
测试查询 fileID 1 的信息 >> 这是一个文件名称1.txt,txt,task,1,/data/upload/1/202001/0414225006610001
测试查询 fileID 2 的信息 >> 这是一个文件名称2.doc,doc,bug,2,/data/upload/1/202002/0414225006610002
测试查询 fileID 11 的信息 >> 这是一个文件名称11.xlsx,xlsx,traincourse,11,data/course/202002/0414225006610011.xlsx
测试查询 fileID 24 的信息 >> 这是一个文件名称24.avi,avi,traincontents,24,data/course/202006/0414225006610024.avi
测试查询 fileID 81 的信息 >> 这是一个文件名称81.tar,tar,story,81,/data/upload/1/202009/0414225006610081
测试查询 fileID 101 的信息 >> 0
*/
$fileID = array(1, 2, 11, 24, 81, 101);
$file = new fileTest();
r($file->getByIdTest($fileID[0])) && p('title,extension,objectType,objectID,webPath') && e('这是一个文件名称1.txt,txt,task,1,/data/upload/1/202001/0414225006610001'); // 测试查询 fileID 1 的信息
r($file->getByIdTest($fileID[1])) && p('title,extension,objectType,objectID,webPath') && e('这是一个文件名称2.doc,doc,bug,2,/data/upload/1/202002/0414225006610002'); // 测试查询 fileID 2 的信息
r($file->getByIdTest($fileID[2])) && p('title,extension,objectType,objectID,webPath') && e('这是一个文件名称11.xlsx,xlsx,traincourse,11,data/course/202002/0414225006610011.xlsx'); // 测试查询 fileID 11 的信息
r($file->getByIdTest($fileID[3])) && p('title,extension,objectType,objectID,webPath') && e('这是一个文件名称24.avi,avi,traincontents,24,data/course/202006/0414225006610024.avi'); // 测试查询 fileID 24 的信息
r($file->getByIdTest($fileID[4])) && p('title,extension,objectType,objectID,webPath') && e('这是一个文件名称81.tar,tar,story,81,/data/upload/1/202009/0414225006610081'); // 测试查询 fileID 81 的信息
r($file->getByIdTest($fileID[5])) && p('title,extension,objectType,objectID,webPath') && e('0'); // 测试查询 fileID 101 的信息
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->getByObject();
cid=1
pid=1
获取 traincourse id 5 的文件 >> 这是一个文件名称5.wps,wps,traincourse,5,data/course/202005/0414225006610005.wps
获取 traincontents id 6 的文件 >> 这是一个文件名称6.wri,wri,traincontents,6,data/course/202006/0414225006610006.wri
获取 task id 7 的文件 >> 这是一个文件名称7.pdf,pdf,task,7,/data/upload/1/202007/0414225006610007
获取 bug id 8 的文件 >> 这是一个文件名称8.ppt,ppt,bug,8,/data/upload/1/202008/0414225006610008
获取 story id 9 的文件 >> 这是一个文件名称9.pptx,pptx,story,9,/data/upload/1/202009/0414225006610009
获取 testcase id 10 的文件 >> 这是一个文件名称10.xls,xls,testcase,10,/data/upload/1/202001/0414225006610010
获取 testcase id 5 的文件 >> 0
*/
$objectType = array('traincourse', 'traincontents', 'task', 'bug', 'story', 'testcase');
$objectID = array(5, 6, 7, 8, 9, 10);
$extra = 0;
$file = new fileTest();
r($file->getByObjectTest($objectType[0], $objectID[0])) && p('5:title,extension,objectType,objectID,webPath') && e('这是一个文件名称5.wps,wps,traincourse,5,data/course/202005/0414225006610005.wps'); // 获取 traincourse id 5 的文件
r($file->getByObjectTest($objectType[1], $objectID[1])) && p('6:title,extension,objectType,objectID,webPath') && e('这是一个文件名称6.wri,wri,traincontents,6,data/course/202006/0414225006610006.wri'); // 获取 traincontents id 6 的文件
r($file->getByObjectTest($objectType[2], $objectID[2])) && p('7:title,extension,objectType,objectID,webPath') && e('这是一个文件名称7.pdf,pdf,task,7,/data/upload/1/202007/0414225006610007'); // 获取 task id 7 的文件
r($file->getByObjectTest($objectType[3], $objectID[3])) && p('8:title,extension,objectType,objectID,webPath') && e('这是一个文件名称8.ppt,ppt,bug,8,/data/upload/1/202008/0414225006610008'); // 获取 bug id 8 的文件
r($file->getByObjectTest($objectType[4], $objectID[4])) && p('9:title,extension,objectType,objectID,webPath') && e('这是一个文件名称9.pptx,pptx,story,9,/data/upload/1/202009/0414225006610009'); // 获取 story id 9 的文件
r($file->getByObjectTest($objectType[5], $objectID[5])) && p('10:title,extension,objectType,objectID,webPath') && e('这是一个文件名称10.xls,xls,testcase,10,/data/upload/1/202001/0414225006610010'); // 获取 testcase id 10 的文件
r($file->getByObjectTest($objectType[5], $objectID[0])) && p() && e('0'); // 获取 testcase id 5 的文件
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->getCount();
cid=1
pid=1
测试 获取files 的个数 1 >> 2
测试 获取files 的个数 2 >> 4
测试 获取files 的个数 3 >> 5
测试 获取files 的个数 4 >> 7
测试 获取files 的个数 5 >> 10
*/
$file = new fileTest();
$fileNames = array('file1.jpg', 'file2.txt');
$fileSizes = array(1888573, 2384);
$fileTmpName = array('/tmp/phpus8Ebc', '/tmp/phpwNzwuS');
$files = array('name' => $fileNames, 'size' => $fileSizes, 'tmp_name' => $fileTmpName);
$labels = array('file1.jpg', 'file2.txt');
r($file->getCountTest($files, $labels)) && p() && e('2'); // 测试 获取files 的个数 1
$fileNames = array_merge($fileNames, array('file3.ppt', 'file4.mp4'));
$fileSizes = array_merge($fileSizes, array(2893, 34789));
$fileTmpName = array_merge($fileTmpName, array('/tmp/phpu2elbc', '/tmp/phpwje9uS'));
$files = array('name' => $fileNames, 'size' => $fileSizes, 'tmp_name' => $fileTmpName);
$labels = array_merge($labels, array('file3.ppt', 'file4.mp4'));
r($file->getCountTest($files, $labels)) && p() && e('4'); // 测试 获取files 的个数 2
$fileNames = array_merge($fileNames, array('file5.pptx'));
$fileSizes = array_merge($fileSizes, array(28789));
$fileTmpName = array_merge($fileTmpName, array('/tmp/phpu2e9uS'));
$files = array('name' => $fileNames, 'size' => $fileSizes, 'tmp_name' => $fileTmpName);
$labels = array_merge($labels, array('file5.pptx'));
r($file->getCountTest($files, $labels)) && p() && e('5'); // 测试 获取files 的个数 3
$fileNames = array_merge($fileNames, array('file6.ppt', 'file7.mp4'));
$fileSizes = array_merge($fileSizes, array(893, 23089));
$fileTmpName = array_merge($fileTmpName, array('/tmp/phpu2elbc', '/tmp/phpwje9uS'));
$files = array('name' => $fileNames, 'size' => $fileSizes, 'tmp_name' => $fileTmpName);
$labels = array_merge($labels, array('file6.ppt', 'file7.mp4'));
r($file->getCountTest($files, $labels)) && p() && e('7'); // 测试 获取files 的个数 4
$fileNames = array_merge($fileNames, array('file9.ppt', 'file10.mp4', 'file11.wri'));
$fileSizes = array_merge($fileSizes, array(2893, 389, 293838));
$fileTmpName = array_merge($fileTmpName, array('/tmp/phpu2ssbc', '/tmp/phpe0e9uS', '/tmp/phpjf93jf9'));
$files = array('name' => $fileNames, 'size' => $fileSizes, 'tmp_name' => $fileTmpName);
$labels = array_merge($labels, array('file9.ppt', 'file10.mp4', 'file11.wri'));
r($file->getCountTest($files, $labels)) && p() && e('10'); // 测试 获取files 的个数 5
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->getExtension();
cid=1
pid=1
获取 1.xlsm 的扩展名 >> xlsm
获取 2.jpg 的扩展名 >> jpg
获取 3.ppt 的扩展名 >> txt
获取 4.txt 的扩展名 >> mp4
获取 5.zip 的扩展名 >> zip
获取 1.php 的扩展名 >> txt
获取 2.phtml 的扩展名 >> txt
获取 3.jsp 的扩展名 >> txt
获取 4.py 的扩展名 >> txt
获取 5.abc 的扩展名 >> txt
*/
$fileNames = array('1.xlsm', '2.jpg', '3.txt', '4.mp4::mp4', '5.zip::zip');
$errorFileNames = array('1.php', '2.phtml', '3.jsp', '4.py', '5.abc');
$file = new fileTest();
r($file->getExtensionTest($fileNames[0])) && p() && e('xlsm'); // 获取 1.xlsm 的扩展名
r($file->getExtensionTest($fileNames[1])) && p() && e('jpg'); // 获取 2.jpg 的扩展名
r($file->getExtensionTest($fileNames[2])) && p() && e('txt'); // 获取 3.ppt 的扩展名
r($file->getExtensionTest($fileNames[3])) && p() && e('mp4'); // 获取 4.txt 的扩展名
r($file->getExtensionTest($fileNames[4])) && p() && e('zip'); // 获取 5.zip 的扩展名
r($file->getExtensionTest($errorFileNames[0])) && p() && e('txt'); // 获取 1.php 的扩展名
r($file->getExtensionTest($errorFileNames[1])) && p() && e('txt'); // 获取 2.phtml 的扩展名
r($file->getExtensionTest($errorFileNames[2])) && p() && e('txt'); // 获取 3.jsp 的扩展名
r($file->getExtensionTest($errorFileNames[3])) && p() && e('txt'); // 获取 4.py 的扩展名
r($file->getExtensionTest($errorFileNames[4])) && p() && e('txt'); // 获取 5.abc 的扩展名
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->getPairs();
cid=1
pid=1
测试获取文件 1 2 3 4 5 的 标题 >> 这是一个文件名称1.txt,这是一个文件名称2.doc,这是一个文件名称3.docx,这是一个文件名称4.dot,这是一个文件名称5.wps
测试获取文件 6 7 8 9 10 的 标题 >> 这是一个文件名称6.wri,这是一个文件名称7.pdf,这是一个文件名称8.ppt,这是一个文件名称9.pptx,这是一个文件名称10.xls
测试获取文件 11 12 13 14 15 的 标题 >> 这是一个文件名称11.xlsx,这是一个文件名称12.ett,这是一个文件名称13.xlt,这是一个文件名称14.xlsm,这是一个文件名称15.csv
测试获取文件 16 17 18 19 20 的 标题 >> 这是一个文件名称16.jpg,这是一个文件名称17.jpeg,这是一个文件名称18.png,这是一个文件名称19.psd,这是一个文件名称20.gif
测试获取文件 21 22 23 24 25 的 标题 >> 这是一个文件名称21.ico,这是一个文件名称22.bmp,这是一个文件名称23.swf,这是一个文件名称24.avi,这是一个文件名称25.rmvb
测试获取文件 1 2 3 4 5 的 扩展名 >> txt,doc,docx,dot,wps
测试获取文件 6 7 8 9 10 的 扩展名 >> wri,pdf,ppt,pptx,xls
测试获取文件 11 12 13 14 15 的 扩展名 >> xlsx,ett,xlt,xlsm,csv
测试获取文件 16 17 18 19 20 的 扩展名 >> jpg,jpeg,png,psd,gif
测试获取文件 21 22 23 24 25 的 扩展名 >> ico,bmp,swf,avi,rmvb
*/
$fileIDs = 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');
$titles = array('title', 'extension');
$file = new fileTest();
r($file->getPairsTest($fileIDs[0], $titles[0])) && p('1,2,3,4,5') && e('这是一个文件名称1.txt,这是一个文件名称2.doc,这是一个文件名称3.docx,这是一个文件名称4.dot,这是一个文件名称5.wps'); // 测试获取文件 1 2 3 4 5 的 标题
r($file->getPairsTest($fileIDs[1], $titles[0])) && p('6,7,8,9,10') && e('这是一个文件名称6.wri,这是一个文件名称7.pdf,这是一个文件名称8.ppt,这是一个文件名称9.pptx,这是一个文件名称10.xls'); // 测试获取文件 6 7 8 9 10 的 标题
r($file->getPairsTest($fileIDs[2], $titles[0])) && p('11,12,13,14,15') && e('这是一个文件名称11.xlsx,这是一个文件名称12.ett,这是一个文件名称13.xlt,这是一个文件名称14.xlsm,这是一个文件名称15.csv'); // 测试获取文件 11 12 13 14 15 的 标题
r($file->getPairsTest($fileIDs[3], $titles[0])) && p('16,17,18,19,20') && e('这是一个文件名称16.jpg,这是一个文件名称17.jpeg,这是一个文件名称18.png,这是一个文件名称19.psd,这是一个文件名称20.gif'); // 测试获取文件 16 17 18 19 20 的 标题
r($file->getPairsTest($fileIDs[4], $titles[0])) && p('21,22,23,24,25') && e('这是一个文件名称21.ico,这是一个文件名称22.bmp,这是一个文件名称23.swf,这是一个文件名称24.avi,这是一个文件名称25.rmvb'); // 测试获取文件 21 22 23 24 25 的 标题
r($file->getPairsTest($fileIDs[0], $titles[1])) && p('1,2,3,4,5') && e('txt,doc,docx,dot,wps'); // 测试获取文件 1 2 3 4 5 的 扩展名
r($file->getPairsTest($fileIDs[1], $titles[1])) && p('6,7,8,9,10') && e('wri,pdf,ppt,pptx,xls'); // 测试获取文件 6 7 8 9 10 的 扩展名
r($file->getPairsTest($fileIDs[2], $titles[1])) && p('11,12,13,14,15') && e('xlsx,ett,xlt,xlsm,csv'); // 测试获取文件 11 12 13 14 15 的 扩展名
r($file->getPairsTest($fileIDs[3], $titles[1])) && p('16,17,18,19,20') && e('jpg,jpeg,png,psd,gif'); // 测试获取文件 16 17 18 19 20 的 扩展名
r($file->getPairsTest($fileIDs[4], $titles[1])) && p('21,22,23,24,25') && e('ico,bmp,swf,avi,rmvb'); // 测试获取文件 21 22 23 24 25 的 扩展名
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->getPathOfImportedFile();
cid=1
pid=1
获取导入路径 >> tmp/import
*/
$file = new fileTest();
r($file->getPathOfImportedFileTest()) && p() && e('tmp/import'); // 获取导入路径
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->getRealPathName();
cid=1
pid=1
获取 202205/1.txt 的实际存储路径 >> 202205/1
获取 202204/2.png 的实际存储路径 >> 202204/2
获取 202203/3.mp4 的实际存储路径 >> 202203/3
获取 202202/4.zip 的实际存储路径 >> 202202/4
获取 202201/5 的实际存储路径 >> 202201/5
*/
$pathnames = array('202205/1.txt', '202204/2.png', '202203/3.mp4', '202202/4.zip', '202201/5');
$file = new fileTest();
r($file->getRealPathNameTest($pathnames[0])) && p() && e('202205/1'); // 获取 202205/1.txt 的实际存储路径
r($file->getRealPathNameTest($pathnames[1])) && p() && e('202204/2'); // 获取 202204/2.png 的实际存储路径
r($file->getRealPathNameTest($pathnames[2])) && p() && e('202203/3'); // 获取 202203/3.mp4 的实际存储路径
r($file->getRealPathNameTest($pathnames[3])) && p() && e('202202/4'); // 获取 202202/4.zip 的实际存储路径
r($file->getRealPathNameTest($pathnames[4])) && p() && e('202201/5'); // 获取 202201/5 的实际存储路径
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->getSaveName();
cid=1
pid=1
获取 202205/1.txt 的实际存储名称 >> 202205/1
获取 202204/2.png 的实际存储名称 >> 202204/2
获取 202203/3.mp4 的实际存储名称 >> 202203/3
获取 202202/4.zip 的实际存储名称 >> 202202/4
获取 202201/5 的实际存储名称 >> 202201/5
*/
$pathnames = array('202205/1.txt', '202204/2.png', '202203/3.mp4', '202202/4.zip', '202201/5');
$file = new fileTest();
r($file->getSaveNameTest($pathnames[0])) && p() && e('202205/1'); // 获取 202205/1.txt 的实际存储名称
r($file->getSaveNameTest($pathnames[1])) && p() && e('202204/2'); // 获取 202204/2.png 的实际存储名称
r($file->getSaveNameTest($pathnames[2])) && p() && e('202203/3'); // 获取 202203/3.mp4 的实际存储名称
r($file->getSaveNameTest($pathnames[3])) && p() && e('202202/4'); // 获取 202202/4.zip 的实际存储名称
r($file->getSaveNameTest($pathnames[4])) && p() && e('202201/5'); // 获取 202201/5 的实际存储名称
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->getUpload();
cid=1
pid=1
测试获取上传的文件信息1 >> file1.jpg;file2.txt
测试获取上传的文件信息2 >> file3.ppt;file4.mp4
测试获取上传的文件信息3 >> file5.pptx
测试获取上传的文件信息4 >> file6.ppt;file7.mp4
测试获取上传的文件信息5 >> file9.ppt;file10.mp4;file11.wri
*/
$file = new fileTest();
$fileNames = array('file1.jpg', 'file2.txt');
$fileSizes = array(1888573, 2384);
$fileTmpName = array('/tmp/phpus8Ebc', '/tmp/phpwNzwuS');
$files1 = array('name' => $fileNames, 'size' => $fileSizes, 'tmp_name' => $fileTmpName);
$labels1 = array('file1.jpg', 'file2.txt');
$fileNames = array('file3.ppt', 'file4.mp4');
$fileSizes = array(2893, 34789);
$fileTmpName = array('/tmp/phpu2elbc', '/tmp/phpwje9uS');
$files2 = array('name' => $fileNames, 'size' => $fileSizes, 'tmp_name' => $fileTmpName);
$labels2 = array('file3.ppt', 'file4.mp4');
$fileNames = array('file5.pptx');
$fileSizes = array(28789);
$fileTmpName = array('/tmp/phpu2e9uS');
$files3 = array('name' => $fileNames, 'size' => $fileSizes, 'tmp_name' => $fileTmpName);
$labels3 = array('file5.pptx');
$fileNames = array('file6.ppt', 'file7.mp4');
$fileSizes = array(893, 23089);
$fileTmpName = array('/tmp/phpu2elbc', '/tmp/phpwje9uS');
$files4 = array('name' => $fileNames, 'size' => $fileSizes, 'tmp_name' => $fileTmpName);
$labels4 = array('file6.ppt', 'file7.mp4');
$fileNames = array('file9.ppt', 'file10.mp4', 'file11.wri');
$fileSizes = array(2893, 389, 293838);
$fileTmpName = array('/tmp/phpu2ssbc', '/tmp/phpe0e9uS', '/tmp/phpjf93jf9');
$files5 = array('name' => $fileNames, 'size' => $fileSizes, 'tmp_name' => $fileTmpName);
$labels5 = array('file9.ppt', 'file10.mp4', 'file11.wri');
r($file->getUploadTest($files1, $labels1)) && p('0:title;1:title') && e('file1.jpg;file2.txt'); // 测试获取上传的文件信息1
r($file->getUploadTest($files2, $labels2)) && p('0:title;1:title') && e('file3.ppt;file4.mp4'); // 测试获取上传的文件信息2
r($file->getUploadTest($files3, $labels3)) && p('0:title') && e('file5.pptx'); // 测试获取上传的文件信息3
r($file->getUploadTest($files4, $labels4)) && p('0:title;1:title') && e('file6.ppt;file7.mp4'); // 测试获取上传的文件信息4
r($file->getUploadTest($files5, $labels5)) && p('0:title;1:title;2:title') && e('file9.ppt;file10.mp4;file11.wri'); // 测试获取上传的文件信息5
+69
View File
@@ -0,0 +1,69 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->getUploadFile();
cid=1
pid=1
测试获取上传image1时的文件信息 >> png,img1,3021,/tmp/phpsjisk
测试获取上传image2时的文件信息 >> png,img2,3281,/tmp/phpsjisk
测试获取上传image3时的文件信息 >> png,img3,938,/tmp/phpsjisk
测试获取上传image4时的文件信息 >> png,img4,4821,/tmp/phpsjisk
测试获取上传image5时的文件信息 >> png,img5,9870,/tmp/phpsjisk
*/
$image1 = new stdclass();
$image1->name = 'img1.png';
$image1->chunk = 0;
$image1->chunks = 1;
$image1->label = 'img1';
$image1->uuid = 'o_peahuifhuieafj';
$image1->size = '3021';
$image2 = new stdclass();
$image2->name = 'img2.png';
$image2->chunk = 0;
$image2->chunks = 1;
$image2->label = 'img2';
$image2->uuid = 'o_fnjakehfjkahek';
$image2->size = '3281';
$image3 = new stdclass();
$image3->name = 'img3.png';
$image3->chunk = 0;
$image3->chunks = 1;
$image3->label = 'img3';
$image3->uuid = 'o_fjaieojfioeiei';
$image3->size = '938';
$image4 = new stdclass();
$image4->name = 'img4.png';
$image4->chunk = 0;
$image4->chunks = 1;
$image4->label = 'img4';
$image4->uuid = 'o_aehufhuihfiuae';
$image4->size = '4821';
$image5 = new stdclass();
$image5->name = 'img5.png';
$image5->chunk = 0;
$image5->chunks = 1;
$image5->label = 'img5';
$image5->uuid = 'o_hfauehuihfiuae';
$image5->size = '9870';
$files = array('tmp_name' => '/tmp/phpsjisk', 'name' => 'filename');
$file = new fileTest();
r($file->getUploadFileTest($image1, $files)) && p('extension,title,size,tmpname') && e('png,img1,3021,/tmp/phpsjisk'); // 测试获取上传image1时的文件信息
r($file->getUploadFileTest($image2, $files)) && p('extension,title,size,tmpname') && e('png,img2,3281,/tmp/phpsjisk'); // 测试获取上传image2时的文件信息
r($file->getUploadFileTest($image3, $files)) && p('extension,title,size,tmpname') && e('png,img3,938,/tmp/phpsjisk'); // 测试获取上传image3时的文件信息
r($file->getUploadFileTest($image4, $files)) && p('extension,title,size,tmpname') && e('png,img4,4821,/tmp/phpsjisk'); // 测试获取上传image4时的文件信息
r($file->getUploadFileTest($image5, $files)) && p('extension,title,size,tmpname') && e('png,img5,9870,/tmp/phpsjisk'); // 测试获取上传image5时的文件信息
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/file.class.php';
su('admin');
/**
title=测试 fileModel->setSavePath();
cid=1
pid=1
测试更新savePath >> /www/data/upload/1/
*/
$file = new fileTest();
r($file->setSavePathTest()) && p() && e('/www/data/upload/1/'); // 测试更新savePath

Some files were not shown because too many files have changed in this diff Show More