Merge branch 'sprint/master_zhouxudong_message'

This commit is contained in:
孙广明
2022-05-06 17:17:29 +08:00
37 changed files with 1569 additions and 67 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. */
+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')
+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;
}
}
+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;
}
}
+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: ""
+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
+4
View File
@@ -62,5 +62,9 @@ fields:
- field: subStatus
range: ' '
- field: notify
range: PO,PD
postfix: ","
- field: deleted
range: 0
+3 -1
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'));
@@ -104,6 +105,7 @@ $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->weeklyreport = array('rows' => 10, 'extends' => array('weeklyreport'));
$builder->metting = array('rows' => 10, 'extends' => array('meeting'));
$builder->pipeline = array('rows' => 2, 'extends' => array('pipeline'));
$builder->holiday = array('rows' => 100, 'extends' => array('holiday'));
@@ -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
+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->setWebPath();
cid=1
pid=1
测试更新webPath >> /test/model/file/data/upload/1/
*/
$file = new fileTest();
r($file->setWebPathTest()) && p() && e('/test/model/file/data/upload/1/'); // 测试更新webPath
+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/file.class.php';
su('admin');
/**
title=测试 fileModel->updateObjectID();
cid=1
pid=1
测试更新 id 1 的objectID 为 101 objectType 为 bug >> 1,101,bug
测试更新 id 2 3 的objectID 为 102 objectType 为 story >> 2,102,story;3,102,story
测试更新 id 4 5 的objectID 为 103 objectType 为 task >> 4,103,task;5,103,task
测试更新 id 6 7 8 的objectID 为 104 objectType 为 traincourse >> 6,104,traincourse;7,104,traincourse;8,104,traincourse
测试更新 id 9 10 11 的objectID 为 105 objectType 为 testcase >> 9,105,testcase;10,105,testcase;11,105,testcase
*/
$uid = '98390890341';
$albums1 = array('used' => array($uid => array('1')));
$albums2 = array('used' => array($uid => array('2', '3')));
$albums3 = array('used' => array($uid => array('4', '5')));
$albums4 = array('used' => array($uid => array('6', '7', '8')));
$albums5 = array('used' => array($uid => array('9', '10', '11')));
$objectID = array(101, 102, 103, 104, 105);
$objectType = array('bug', 'story', 'task', 'traincourse', 'testcase');
$file = new fileTest();
r($file->updateObjectIDTest($uid, $objectID[0], $objectType[0], $albums1)) && p('1:id,objectID,objectType') && e('1,101,bug'); // 测试更新 id 1 的objectID 为 101 objectType 为 bug
r($file->updateObjectIDTest($uid, $objectID[1], $objectType[1], $albums2)) && p('2:id,objectID,objectType;3:id,objectID,objectType') && e('2,102,story;3,102,story'); // 测试更新 id 2 3 的objectID 为 102 objectType 为 story
r($file->updateObjectIDTest($uid, $objectID[2], $objectType[2], $albums3)) && p('4:id,objectID,objectType;5:id,objectID,objectType') && e('4,103,task;5,103,task'); // 测试更新 id 4 5 的objectID 为 103 objectType 为 task
r($file->updateObjectIDTest($uid, $objectID[3], $objectType[3], $albums4)) && p('6:id,objectID,objectType;7:id,objectID,objectType;8:id,objectID,objectType') && e('6,104,traincourse;7,104,traincourse;8,104,traincourse'); // 测试更新 id 6 7 8 的objectID 为 104 objectType 为 traincourse
r($file->updateObjectIDTest($uid, $objectID[4], $objectType[4], $albums5)) && p('9:id,objectID,objectType;10:id,objectID,objectType;11:id,objectID,objectType') && e('9,105,testcase;10,105,testcase;11,105,testcase'); // 测试更新 id 9 10 11 的objectID 为 105 objectType 为 testcase
system('./ztest init');
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/message.class.php';
su('po82');
/**
title=测试 messageModel->getMessages();
cid=1
pid=1
*/
$message = new messageTest();
r($message->getMessagesTest('wait')) && p('1:id') && e('1'); //拿取status为wait的数据信息
r($message->getMessagesTest('wait')) && p('2:action') && e('114'); //拿取status为wait的数据信息
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/message.class.php';
su('admin');
/**
title=测试 messageModel->getNoticeTodos();
cid=1
pid=1
*/
$message = new messageTest();
r($message->getNoticeTodosTest()) && p('0') && e('0'); //查询notice为空的todo的信息
+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/message.class.php';
su('admin');
/**
title=测试 messageModel->getObjectActions();
cid=1
pid=1
*/
$message = new messageTest();
r($message->getObjectActionsTest()) && p('product:opened') && e('创建'); //查询objectType为product的action是opened的lab标签
r($message->getObjectActionsTest()) && p('story:frombug') && e('转研发需求'); //查询objectType为story的action是frombug的lab标签
r($message->getObjectActionsTest()) && p('productplan:edited') && e('编辑'); //查询objectType为productplan的action是edited的lab标签
r($message->getObjectActionsTest()) && p('project:delayed') && e('延期'); //查询objectType为project的action是delayed的lab标签
r($message->getObjectActionsTest()) && p('task:assigned') && e('指派'); //查询objectType为task的action是assigned的lab标签
r($message->getObjectActionsTest()) && p('bug:closed') && e('关闭'); //查询objectType为bug的action是closed的lab标签
r($message->getObjectActionsTest()) && p('case:opened') && e('创建'); //查询objectType为case的action是opended的lab标签
r($message->getObjectActionsTest()) && p('testtask:started') && e('开始'); //查询objectType为testtask的action是starteded的lab标签
r($message->getObjectActionsTest()) && p('todo:edited') && e('编辑'); //查询objectType为todo的action是edited的lab标签
r($message->getObjectActionsTest()) && p('doc:created') && e('创建'); //查询objectType为doc的action是created的lab标签
r($message->getObjectActionsTest()) && p('mr:compilefail') && e('构建失败'); //查询objectType为mr的action是compilefail的lab标签
+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/message.class.php';
su('admin');
/**
title=测试 messageModel->getObjectTypes();
cid=1
pid=1
*/
$message = new messageTest();
r($message->getObjectTypesTest()) && p('product') && e('产品'); //查询objectType为product的objectTypes
r($message->getObjectTypesTest()) && p('story') && e('研发需求'); //查询objectType为story的objectTypes
r($message->getObjectTypesTest()) && p('productplan') && e('计划'); //查询objectType为productplan的objectTypes
r($message->getObjectTypesTest()) && p('project') && e('项目'); //查询objectType为project的objectTypes
r($message->getObjectTypesTest()) && p('task') && e('任务'); //查询objectType为task的objectTypes
r($message->getObjectTypesTest()) && p('bug') && e('Bug'); //查询objectType为bug的objectTypes
r($message->getObjectTypesTest()) && p('case') && e('用例'); //查询objectType为case的objectTypes
r($message->getObjectTypesTest()) && p('testtask') && e('测试单'); //查询objectType为testcase的objectTypes
r($message->getObjectTypesTest()) && p('todo') && e('待办'); //查询objectType为todo的objectTypes
r($message->getObjectTypesTest()) && p('doc') && e('文档'); //查询objectType为doc的objectTypes
r($message->getObjectTypesTest()) && p('mr') && e('合并请求'); //查询objectType为mr的objectTypes
+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/message.class.php';
su('admin');
/**
title=测试 messageModel->getToList();
cid=1
pid=1
*/
$message = new messageTest();
r($message->getToListTest('todo')) && p() && e('admin'); //通过一条todo数据展示$toList
r($message->getToListTest('testtask')) && p() && e('user3'); //通过一条testtask数据展示$toList
r($message->getToListTest('meeting')) && p() && e('admin,admin,'); //通过一条meeting数据展示$toList
r($message->getToListTest('mr')) && p() && e('admin,admin'); //通过一条mr数据展示$toList
r($message->getToListTest('release')) && p() && e('po1'); //通过一条release数据展示$toList
r($message->getToListTest('task')) && p() && e('po82'); //通过一条task数据展示$toList
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/message.class.php';
su('admin');
/**
title=测试 messageModel->saveNotice();
cid=1
pid=1
*/
$message = new messageTest();
r($message->saveNoticeTest('todo', '1', 'product', '1', 'admin')) && p() && e('0'); //通过拿取todo表的第一条数据并且将actor赋值admin获取返回值
r($message->saveNoticeTest('task', '1', 'product', '1', 'admin')) && p() && e('0'); //通过拿取task表的第一条数据并且将actor赋值admin获取返回值
r($message->saveNoticeTest('todo', '1', 'product', '1', '')) && p() && e('0'); //通过拿取todo表的第一条数据并且不给actor赋值获取返回值
r($message->saveNoticeTest('todo', '1', 'product', '1', 'user1')) && p() && e('0'); //通过拿取todo表的第一条数据并且给actor赋值user1获取返回值
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/message.class.php';
su('admin');
/**
title=测试 messageModel->send();
cid=1
pid=1
*/
$message = new messageTest();
r($message->sendTest('todo', '1', 'product', '1', 'admin')) && p() && e('0'); //通过拿取todo表的第一条数据并且将actor赋值admin获取返回值
r($message->sendTest('todo', '0', 'product', '1', 'admin')) && p() && e('0'); //通过拿取todo表的第0条数据并且将actor赋值admin获取返回值
+6
View File
@@ -49,6 +49,9 @@ switch($argv[1])
case 'design':
ztfRun('model/design');
break;
case 'file':
ztfRun('model/file');
break;
case 'execution':
ztfRun('model/execution');
break;
@@ -106,6 +109,9 @@ switch($argv[1])
case 'todo':
ztfRun('model/todo');
break;
case 'message':
ztfRun('model/message');
break;
case 'tree':
ztfRun('model/tree');
break;