From 30170a62baf4cff53dbcc83d53981b6f1cbd14dd Mon Sep 17 00:00:00 2001 From: liyang <“liyang@easycorp.ltd”> Date: Fri, 6 May 2022 17:28:52 +0800 Subject: [PATCH] add doc data --- test/class/doc.class.php | 516 +++++++++++++++++++++ test/data/weeklyreport.yaml | 6 +- test/model/doc/buildbrowseswitch.php | 19 + test/model/doc/buildcollectbutton4doc.php | 19 + test/model/doc/buildcreatebutton4doc.php | 19 + test/model/doc/buildcrumbtitle.php | 19 + test/model/doc/checkautoloadpage.php | 19 + test/model/doc/checkprivdoc.php | 19 + test/model/doc/checkprivlib.php | 19 + test/model/doc/create.php | 55 +++ test/model/doc/createapilib.php | 41 ++ test/model/doc/createlib.php | 56 +++ test/model/doc/extractketablecss.php | 22 + test/model/doc/filldocsintree.php | 19 + test/model/doc/getalllibgroups.php | 19 + test/model/doc/getalllibsbytype.php | 19 + test/model/doc/getapilibs.php | 31 ++ test/model/doc/getapimoduletree.php | 19 + test/model/doc/getbyid.php | 24 + test/model/doc/getbyidlist.php | 21 + test/model/doc/getdocmenu.php | 27 ++ test/model/doc/getdocs.php | 26 ++ test/model/doc/getdocsbybrowsetype.php | 39 ++ test/model/doc/getdoctree.php | 19 + test/model/doc/getexecutionmodulepairs.php | 21 + test/model/doc/getfileicon.php | 19 + test/model/doc/getfilesourcepairs.php | 19 + test/model/doc/getlibbyid.php | 22 + test/model/doc/getlibfiles.php | 19 + test/model/doc/getlibidlistbyproject.php | 19 + test/model/doc/getlibs.php | 65 +++ test/model/doc/getlibsbyobject.php | 19 + test/model/doc/getlimitlibs.php | 19 + test/model/doc/getobjectsbydoc.php | 21 + test/model/doc/getorderedobjects.php | 19 + test/model/doc/getpreandnextdoc.php | 19 + test/model/doc/getprivdocs.php | 28 ++ test/model/doc/getprivlibsbydoc.php | 21 + test/model/doc/getproductcrumb.php | 19 + test/model/doc/getstatisticinfo.php | 19 + test/model/doc/getsublibgroups.php | 19 + test/model/doc/gettoandcclist.php | 19 + test/model/doc/gettreemenu.php | 19 + test/model/doc/printchildmodule.php | 19 + test/model/doc/savedraft.php | 25 + test/model/doc/select.php | 19 + test/model/doc/setfastmenu.php | 19 + test/model/doc/setlibusers.php | 19 + test/model/doc/setmenubytype.php | 19 + test/model/doc/statlibcounts.php | 19 + test/model/doc/summary.php | 19 + test/model/doc/update.php | 47 ++ test/model/doc/updateapilib.php | 37 ++ test/model/doc/updatelib.php | 57 +++ 54 files changed, 1812 insertions(+), 4 deletions(-) create mode 100644 test/class/doc.class.php create mode 100644 test/model/doc/buildbrowseswitch.php create mode 100644 test/model/doc/buildcollectbutton4doc.php create mode 100644 test/model/doc/buildcreatebutton4doc.php create mode 100644 test/model/doc/buildcrumbtitle.php create mode 100644 test/model/doc/checkautoloadpage.php create mode 100644 test/model/doc/checkprivdoc.php create mode 100644 test/model/doc/checkprivlib.php create mode 100644 test/model/doc/create.php create mode 100644 test/model/doc/createapilib.php create mode 100644 test/model/doc/createlib.php create mode 100644 test/model/doc/extractketablecss.php create mode 100644 test/model/doc/filldocsintree.php create mode 100644 test/model/doc/getalllibgroups.php create mode 100644 test/model/doc/getalllibsbytype.php create mode 100644 test/model/doc/getapilibs.php create mode 100644 test/model/doc/getapimoduletree.php create mode 100644 test/model/doc/getbyid.php create mode 100644 test/model/doc/getbyidlist.php create mode 100644 test/model/doc/getdocmenu.php create mode 100644 test/model/doc/getdocs.php create mode 100644 test/model/doc/getdocsbybrowsetype.php create mode 100644 test/model/doc/getdoctree.php create mode 100644 test/model/doc/getexecutionmodulepairs.php create mode 100644 test/model/doc/getfileicon.php create mode 100644 test/model/doc/getfilesourcepairs.php create mode 100644 test/model/doc/getlibbyid.php create mode 100644 test/model/doc/getlibfiles.php create mode 100644 test/model/doc/getlibidlistbyproject.php create mode 100644 test/model/doc/getlibs.php create mode 100644 test/model/doc/getlibsbyobject.php create mode 100644 test/model/doc/getlimitlibs.php create mode 100644 test/model/doc/getobjectsbydoc.php create mode 100644 test/model/doc/getorderedobjects.php create mode 100644 test/model/doc/getpreandnextdoc.php create mode 100644 test/model/doc/getprivdocs.php create mode 100644 test/model/doc/getprivlibsbydoc.php create mode 100644 test/model/doc/getproductcrumb.php create mode 100644 test/model/doc/getstatisticinfo.php create mode 100644 test/model/doc/getsublibgroups.php create mode 100644 test/model/doc/gettoandcclist.php create mode 100644 test/model/doc/gettreemenu.php create mode 100644 test/model/doc/printchildmodule.php create mode 100644 test/model/doc/savedraft.php create mode 100644 test/model/doc/select.php create mode 100644 test/model/doc/setfastmenu.php create mode 100644 test/model/doc/setlibusers.php create mode 100644 test/model/doc/setmenubytype.php create mode 100644 test/model/doc/statlibcounts.php create mode 100644 test/model/doc/summary.php create mode 100644 test/model/doc/update.php create mode 100644 test/model/doc/updateapilib.php create mode 100644 test/model/doc/updatelib.php diff --git a/test/class/doc.class.php b/test/class/doc.class.php new file mode 100644 index 0000000000..143e7413aa --- /dev/null +++ b/test/class/doc.class.php @@ -0,0 +1,516 @@ +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; + } +} diff --git a/test/data/weeklyreport.yaml b/test/data/weeklyreport.yaml index 3af89e6b9a..b7693c1b6b 100644 --- a/test/data/weeklyreport.yaml +++ b/test/data/weeklyreport.yaml @@ -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 diff --git a/test/model/doc/buildbrowseswitch.php b/test/model/doc/buildbrowseswitch.php new file mode 100644 index 0000000000..b371650616 --- /dev/null +++ b/test/model/doc/buildbrowseswitch.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +buildBrowseSwitch(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->buildBrowseSwitchTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/buildcollectbutton4doc.php b/test/model/doc/buildcollectbutton4doc.php new file mode 100644 index 0000000000..d2397de676 --- /dev/null +++ b/test/model/doc/buildcollectbutton4doc.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +buildCollectButton4Doc(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->buildCollectButton4DocTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/buildcreatebutton4doc.php b/test/model/doc/buildcreatebutton4doc.php new file mode 100644 index 0000000000..f6faa0f554 --- /dev/null +++ b/test/model/doc/buildcreatebutton4doc.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +buildCreateButton4Doc(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->buildCreateButton4DocTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/buildcrumbtitle.php b/test/model/doc/buildcrumbtitle.php new file mode 100644 index 0000000000..a23de3163a --- /dev/null +++ b/test/model/doc/buildcrumbtitle.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +buildCrumbTitle(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->buildCrumbTitleTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/checkautoloadpage.php b/test/model/doc/checkautoloadpage.php new file mode 100644 index 0000000000..4d77393db1 --- /dev/null +++ b/test/model/doc/checkautoloadpage.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +checkAutoloadPage(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->checkAutoloadPageTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/checkprivdoc.php b/test/model/doc/checkprivdoc.php new file mode 100644 index 0000000000..c8b39faad5 --- /dev/null +++ b/test/model/doc/checkprivdoc.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +checkPrivDoc(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->checkPrivDocTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/checkprivlib.php b/test/model/doc/checkprivlib.php new file mode 100644 index 0000000000..455b604d6f --- /dev/null +++ b/test/model/doc/checkprivlib.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +checkPrivLib(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->checkPrivLibTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/create.php b/test/model/doc/create.php new file mode 100644 index 0000000000..60d16e880e --- /dev/null +++ b/test/model/doc/create.php @@ -0,0 +1,55 @@ +#!/usr/bin/env php +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"); \ No newline at end of file diff --git a/test/model/doc/createapilib.php b/test/model/doc/createapilib.php new file mode 100644 index 0000000000..442157c270 --- /dev/null +++ b/test/model/doc/createapilib.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +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"); \ No newline at end of file diff --git a/test/model/doc/createlib.php b/test/model/doc/createlib.php new file mode 100644 index 0000000000..eaebcde663 --- /dev/null +++ b/test/model/doc/createlib.php @@ -0,0 +1,56 @@ +#!/usr/bin/env php +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"); \ No newline at end of file diff --git a/test/model/doc/extractketablecss.php b/test/model/doc/extractketablecss.php new file mode 100644 index 0000000000..326c6c9df9 --- /dev/null +++ b/test/model/doc/extractketablecss.php @@ -0,0 +1,22 @@ +#!/usr/bin/env php +extractKETableCSS(); +cid=1 +pid=1 + + + +*/ +global $tester; +$doc = $tester->loadModel('doc'); +$content = 'test'; +$css = ''; + +r($doc->extractKETableCSS($content)) && p() && e('0'); //未过滤数据查询 +r($doc->extractKETableCSS($css)) && p() && e('.ke-table1{border:1px #000000 solid}');//过滤后数据查询 diff --git a/test/model/doc/filldocsintree.php b/test/model/doc/filldocsintree.php new file mode 100644 index 0000000000..28aa89df22 --- /dev/null +++ b/test/model/doc/filldocsintree.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +fillDocsInTree(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->fillDocsInTreeTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getalllibgroups.php b/test/model/doc/getalllibgroups.php new file mode 100644 index 0000000000..90c886c9e6 --- /dev/null +++ b/test/model/doc/getalllibgroups.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getAllLibGroups(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getAllLibGroupsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getalllibsbytype.php b/test/model/doc/getalllibsbytype.php new file mode 100644 index 0000000000..8f213598eb --- /dev/null +++ b/test/model/doc/getalllibsbytype.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getAllLibsByType(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getAllLibsByTypeTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getapilibs.php b/test/model/doc/getapilibs.php new file mode 100644 index 0000000000..012d9f8dbd --- /dev/null +++ b/test/model/doc/getapilibs.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +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'); //查询接口库统计 \ No newline at end of file diff --git a/test/model/doc/getapimoduletree.php b/test/model/doc/getapimoduletree.php new file mode 100644 index 0000000000..95670d6d74 --- /dev/null +++ b/test/model/doc/getapimoduletree.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getApiModuleTree(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getApiModuleTreeTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getbyid.php b/test/model/doc/getbyid.php new file mode 100644 index 0000000000..a34f860421 --- /dev/null +++ b/test/model/doc/getbyid.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +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的文档内容 \ No newline at end of file diff --git a/test/model/doc/getbyidlist.php b/test/model/doc/getbyidlist.php new file mode 100644 index 0000000000..74ec12d822 --- /dev/null +++ b/test/model/doc/getbyidlist.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +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'); //查询文档库下的文档统计 \ No newline at end of file diff --git a/test/model/doc/getdocmenu.php b/test/model/doc/getdocmenu.php new file mode 100644 index 0000000000..f1cc218282 --- /dev/null +++ b/test/model/doc/getdocmenu.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +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'); //无效数据查询 \ No newline at end of file diff --git a/test/model/doc/getdocs.php b/test/model/doc/getdocs.php new file mode 100644 index 0000000000..e782b17128 --- /dev/null +++ b/test/model/doc/getdocs.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +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为空查询 \ No newline at end of file diff --git a/test/model/doc/getdocsbybrowsetype.php b/test/model/doc/getdocsbybrowsetype.php new file mode 100644 index 0000000000..0b987b50e8 --- /dev/null +++ b/test/model/doc/getdocsbybrowsetype.php @@ -0,0 +1,39 @@ +#!/usr/bin/env php +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类型查询 \ No newline at end of file diff --git a/test/model/doc/getdoctree.php b/test/model/doc/getdoctree.php new file mode 100644 index 0000000000..247c9b34ec --- /dev/null +++ b/test/model/doc/getdoctree.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getDocTree(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getDocTreeTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getexecutionmodulepairs.php b/test/model/doc/getexecutionmodulepairs.php new file mode 100644 index 0000000000..1b9299fbb2 --- /dev/null +++ b/test/model/doc/getexecutionmodulepairs.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +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'); //正常查询统计 \ No newline at end of file diff --git a/test/model/doc/getfileicon.php b/test/model/doc/getfileicon.php new file mode 100644 index 0000000000..7dc8bf3819 --- /dev/null +++ b/test/model/doc/getfileicon.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getFileIcon(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getFileIconTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getfilesourcepairs.php b/test/model/doc/getfilesourcepairs.php new file mode 100644 index 0000000000..f4f4279d42 --- /dev/null +++ b/test/model/doc/getfilesourcepairs.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getFileSourcePairs(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getFileSourcePairsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getlibbyid.php b/test/model/doc/getlibbyid.php new file mode 100644 index 0000000000..90ffbf10b4 --- /dev/null +++ b/test/model/doc/getlibbyid.php @@ -0,0 +1,22 @@ +#!/usr/bin/env php +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'); //查询不存在的文档库 \ No newline at end of file diff --git a/test/model/doc/getlibfiles.php b/test/model/doc/getlibfiles.php new file mode 100644 index 0000000000..9c9b825e20 --- /dev/null +++ b/test/model/doc/getlibfiles.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getLibFiles(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getLibFilesTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getlibidlistbyproject.php b/test/model/doc/getlibidlistbyproject.php new file mode 100644 index 0000000000..7b73aa1285 --- /dev/null +++ b/test/model/doc/getlibidlistbyproject.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getLibIdListByProject(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getLibIdListByProjectTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getlibs.php b/test/model/doc/getlibs.php new file mode 100644 index 0000000000..dc0e76e9a4 --- /dev/null +++ b/test/model/doc/getlibs.php @@ -0,0 +1,65 @@ +#!/usr/bin/env php +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'); //执行单独查询统计 \ No newline at end of file diff --git a/test/model/doc/getlibsbyobject.php b/test/model/doc/getlibsbyobject.php new file mode 100644 index 0000000000..04f9d2bfd4 --- /dev/null +++ b/test/model/doc/getlibsbyobject.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getLibsByObject(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getLibsByObjectTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getlimitlibs.php b/test/model/doc/getlimitlibs.php new file mode 100644 index 0000000000..2d1f7cdda2 --- /dev/null +++ b/test/model/doc/getlimitlibs.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getLimitLibs(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getLimitLibsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getobjectsbydoc.php b/test/model/doc/getobjectsbydoc.php new file mode 100644 index 0000000000..7a6af46349 --- /dev/null +++ b/test/model/doc/getobjectsbydoc.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +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');//查询文档库的项目产品迭代 \ No newline at end of file diff --git a/test/model/doc/getorderedobjects.php b/test/model/doc/getorderedobjects.php new file mode 100644 index 0000000000..bd315aaafc --- /dev/null +++ b/test/model/doc/getorderedobjects.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getOrderedObjects(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getOrderedObjectsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getpreandnextdoc.php b/test/model/doc/getpreandnextdoc.php new file mode 100644 index 0000000000..0e9019503d --- /dev/null +++ b/test/model/doc/getpreandnextdoc.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getPreAndNextDoc(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getPreAndNextDocTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getprivdocs.php b/test/model/doc/getprivdocs.php new file mode 100644 index 0000000000..2aa2c347ff --- /dev/null +++ b/test/model/doc/getprivdocs.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +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查询统计 \ No newline at end of file diff --git a/test/model/doc/getprivlibsbydoc.php b/test/model/doc/getprivlibsbydoc.php new file mode 100644 index 0000000000..df33fddd9a --- /dev/null +++ b/test/model/doc/getprivlibsbydoc.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +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');//正常查询统计 \ No newline at end of file diff --git a/test/model/doc/getproductcrumb.php b/test/model/doc/getproductcrumb.php new file mode 100644 index 0000000000..b252657206 --- /dev/null +++ b/test/model/doc/getproductcrumb.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getProductCrumb(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getProductCrumbTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getstatisticinfo.php b/test/model/doc/getstatisticinfo.php new file mode 100644 index 0000000000..26ceba1733 --- /dev/null +++ b/test/model/doc/getstatisticinfo.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getStatisticInfo(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getStatisticInfoTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/getsublibgroups.php b/test/model/doc/getsublibgroups.php new file mode 100644 index 0000000000..5e01e31131 --- /dev/null +++ b/test/model/doc/getsublibgroups.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getSubLibGroups(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getSubLibGroupsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/gettoandcclist.php b/test/model/doc/gettoandcclist.php new file mode 100644 index 0000000000..8be6905993 --- /dev/null +++ b/test/model/doc/gettoandcclist.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getToAndCcList(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getToAndCcListTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/gettreemenu.php b/test/model/doc/gettreemenu.php new file mode 100644 index 0000000000..d94649bdaf --- /dev/null +++ b/test/model/doc/gettreemenu.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getTreeMenu(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->getTreeMenuTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/printchildmodule.php b/test/model/doc/printchildmodule.php new file mode 100644 index 0000000000..9a237d4e96 --- /dev/null +++ b/test/model/doc/printchildmodule.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +printChildModule(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->printChildModuleTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/savedraft.php b/test/model/doc/savedraft.php new file mode 100644 index 0000000000..9153c3fc9d --- /dev/null +++ b/test/model/doc/savedraft.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +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"); \ No newline at end of file diff --git a/test/model/doc/select.php b/test/model/doc/select.php new file mode 100644 index 0000000000..76d998c270 --- /dev/null +++ b/test/model/doc/select.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +select(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->selectTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/setfastmenu.php b/test/model/doc/setfastmenu.php new file mode 100644 index 0000000000..102ce1f6d8 --- /dev/null +++ b/test/model/doc/setfastmenu.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +setFastMenu(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->setFastMenuTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/setlibusers.php b/test/model/doc/setlibusers.php new file mode 100644 index 0000000000..0485e11ee1 --- /dev/null +++ b/test/model/doc/setlibusers.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +setLibUsers(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->setLibUsersTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/setmenubytype.php b/test/model/doc/setmenubytype.php new file mode 100644 index 0000000000..c1b08d8df8 --- /dev/null +++ b/test/model/doc/setmenubytype.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +setMenuByType(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->setMenuByTypeTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/statlibcounts.php b/test/model/doc/statlibcounts.php new file mode 100644 index 0000000000..730df24862 --- /dev/null +++ b/test/model/doc/statlibcounts.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +statLibCounts(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->statLibCountsTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/summary.php b/test/model/doc/summary.php new file mode 100644 index 0000000000..1c750a7518 --- /dev/null +++ b/test/model/doc/summary.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +summary(); +cid=1 +pid=1 + + + +*/ + +$doc = new docTest(); + +r($doc->summaryTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/doc/update.php b/test/model/doc/update.php new file mode 100644 index 0000000000..21ee7ccc0c --- /dev/null +++ b/test/model/doc/update.php @@ -0,0 +1,47 @@ +#!/usr/bin/env php +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"); \ No newline at end of file diff --git a/test/model/doc/updateapilib.php b/test/model/doc/updateapilib.php new file mode 100644 index 0000000000..6fa09031a1 --- /dev/null +++ b/test/model/doc/updateapilib.php @@ -0,0 +1,37 @@ +#!/usr/bin/env php +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"); \ No newline at end of file diff --git a/test/model/doc/updatelib.php b/test/model/doc/updatelib.php new file mode 100644 index 0000000000..ca022ed8f0 --- /dev/null +++ b/test/model/doc/updatelib.php @@ -0,0 +1,57 @@ +#!/usr/bin/env php +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"); \ No newline at end of file