diff --git a/test/class/admin.class.php b/test/class/admin.class.php new file mode 100644 index 0000000000..2fb907a7f6 --- /dev/null +++ b/test/class/admin.class.php @@ -0,0 +1,198 @@ +objectModel = $tester->loadModel('admin'); + $this->user = $tester->loadModel('user'); + $this->communityConfig = $app->loadConfig('community'); + $this->adminConfig = $config->admin; + } + + /** + * Post data form API. + * + * @param string $url + * @param string $formvars + * @access public + * @return void + */ + public function postAPITest() + { + $apiConfig = $this->objectModel->getApiConfig(); + $apiURL = $this->adminConfig->apiRoot . "/user-apiRegister.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest&{$apiConfig->sessionVar}={$apiConfig->sessionID}"; + + $objects = $this->objectModel->postAPI($apiURL); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + + /** + * Get status of zentaopms. + * @access public + * @return void + */ + + public function getStatOfPMSTest() + { + $objects = $this->objectModel->getStatOfPMS(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getStatOfCompanyTest($companyID) + { + $objects = $this->objectModel->getStatOfCompany($companyID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getStatOfSysTest() + { + $objects = $this->objectModel->getStatOfSys(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function registerByAPITest() + { + $objects = $this->objectModel->registerByAPI(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + /** + * Login zentao by API. + * + * @access public + * @return void + */ + public function bindByAPITest($param) + { + $_POST = $param; + $objects = $this->objectModel->bindByAPI(); + $objects = json_decode($objects); + unset($_POST); + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getSecretKeyTest() + { + $objects = $this->objectModel->getSecretKey(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function sendCodeByAPITest($type) + { + $objects = $this->objectModel->sendCodeByAPI($type); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function certifyByAPITest($type) + { + $objects = $this->objectModel->certifyByAPI($type); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function setCompanyByAPITest() + { + $objects = $this->objectModel->setCompanyByAPI(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get signature. + * + * @param array $params + * @access public + * @return string + */ + + public function getSignatureTest() + { + $params['u'] = $this->communityConfig; + $params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequet'; + + $apiConfig = $this->objectModel->getApiConfig(); + $params[$apiConfig->sessionVar] = $apiConfig->sessionID; + + $objects = $this->objectModel->getSignature($params); + + if(dao::isError()) return dao::getError(); + + if($objects){ + return true; + }else{ + return false; + } + } + + + public function getApiConfigTest() + { + $objects = $this->objectModel->getApiConfig(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get register information. + * + * @access public + * @return object + */ + public function getRegisterInfoTest() + { + $objects = $this->objectModel->getRegisterInfo(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + /** + * Check weak. + * + * @param object $user + * @access public + * @return bool + */ + + public function checkWeakTest($account) + { + $user = $this->user->getById($account); + $objects = $this->objectModel->checkWeak($user); + + if(dao::isError()) return dao::getError(); + + return $objects; + } +} diff --git a/test/data/moretask.yaml b/test/data/moretask.yaml index 19a589fe73..264461b304 100644 --- a/test/data/moretask.yaml +++ b/test/data/moretask.yaml @@ -185,8 +185,7 @@ fields: format: "" - field: assignedTo note: "指派给" - from: common.user.v1.yaml - use: user + range: "" prefix: "" postfix: "" loop: 0 diff --git a/test/data/task.yaml b/test/data/task.yaml index d74d81ee78..8adca0b47c 100644 --- a/test/data/task.yaml +++ b/test/data/task.yaml @@ -185,8 +185,7 @@ fields: format: "" - field: assignedTo note: "指派给" - from: common.user.v1.yaml - use: user + range: "" prefix: "" postfix: "" loop: 0 diff --git a/test/data/taskestimate.yaml b/test/data/taskestimate.yaml index a77ef4aebd..e947141c7c 100644 --- a/test/data/taskestimate.yaml +++ b/test/data/taskestimate.yaml @@ -12,12 +12,12 @@ fields: format: "" - field: date note: "更新日期" - from: common.date.v1.yaml - use: dateB + range: "(-1M)-(+1w):60s" + type: timestamp + format: "YYYY-MM-DD hh:mm:ss" prefix: "" postfix: "" loop: 0 - format: "" - field: left note: "总计消耗" range: 0 diff --git a/test/data/taskson.yaml b/test/data/taskson.yaml index eab4b3786c..3b7c794305 100644 --- a/test/data/taskson.yaml +++ b/test/data/taskson.yaml @@ -185,8 +185,7 @@ fields: format: "" - field: assignedTo note: "指派给" - from: common.user.v1.yaml - use: user + range: po82,user92 prefix: "" postfix: "" loop: 0 diff --git a/test/model/admin/bindbyapi.php.bak b/test/model/admin/bindbyapi.php.bak new file mode 100755 index 0000000000..e16727e4f7 --- /dev/null +++ b/test/model/admin/bindbyapi.php.bak @@ -0,0 +1,27 @@ +#!/usr/bin/env php +bindByAPI(); +cid=1 +pid=1 + +正常测试 >> success;wxm11,j8a5qCRTleJh9Gv4 +错误密码测试 >> fail;登录失败,请检查您的用户名或密码是否填写正确。 +post数据为空测试 >> fail;登录失败,请检查您的用户名或密码是否填写正确。 + +*/ + +$admin = new adminTest(); + +$paramInfo = array('account' => 'wxm11', 'password' => '123qweasd', 'sn' => 'c8aa3269e181f2b9258ce96625de1497', 'site' => 'http://zentaopmsdemo.com'); +$errorPwd = array('account' => 'wxm11', 'password' => '123', 'sn' => 'c8aa3269e181f2b9258ce96625de1497', 'site' => 'http://zentaopmsdemo.com'); +$emptyPost = array(); + +r($admin->bindByAPITest($errorPwd)) && p('result;message') && e('fail;登录失败,请检查您的用户名或密码是否填写正确。'); //错误密码测试 +r($admin->bindByAPITest($emptyPost)) && p('result;message') && e('fail;登录失败,请检查您的用户名或密码是否填写正确。'); //post数据为空测试 +r($admin->bindByAPITest($paramInfo)) && p('result;data:account,private') && e('success;wxm11,j8a5qCRTleJh9Gv4'); //正常测试 diff --git a/test/model/admin/certifybyapi.php.bak b/test/model/admin/certifybyapi.php.bak new file mode 100755 index 0000000000..ff9b52002c --- /dev/null +++ b/test/model/admin/certifybyapi.php.bak @@ -0,0 +1,19 @@ +#!/usr/bin/env php +certifyByAPI(); +cid=1 +pid=1 + + + +*/ + +$admin = new adminTest(); + +r($admin->certifyByAPITest()) && p() && e(); \ No newline at end of file diff --git a/test/model/admin/checkweak.php b/test/model/admin/checkweak.php new file mode 100755 index 0000000000..57345dcaa4 --- /dev/null +++ b/test/model/admin/checkweak.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +checkWeak(); +cid=1 +pid=1 + +正常测试 >> 0 + +*/ +$account = 'admin'; + +$admin = new adminTest(); + +r($admin->checkWeakTest($account)) && p() && e('0'); //正常测试 \ No newline at end of file diff --git a/test/model/admin/getapiconfig.php.bak b/test/model/admin/getapiconfig.php.bak new file mode 100755 index 0000000000..3293350d96 --- /dev/null +++ b/test/model/admin/getapiconfig.php.bak @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getApiConfig(); +cid=1 +pid=1 + + + +*/ + +$admin = new adminTest(); + +r($admin->getApiConfigTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/admin/getregisterinfo.php b/test/model/admin/getregisterinfo.php new file mode 100755 index 0000000000..8ffcbd13f9 --- /dev/null +++ b/test/model/admin/getregisterinfo.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getRegisterInfo(); +cid=1 +pid=1 + +正常测试 >> 易软天创网络科技有限公司 + +*/ + +$admin = new adminTest(); + +r($admin->getRegisterInfoTest()) && p('company') && e('易软天创网络科技有限公司'); //正常测试 \ No newline at end of file diff --git a/test/model/admin/getsecretkey.php.bak b/test/model/admin/getsecretkey.php.bak new file mode 100755 index 0000000000..60e1f74a66 --- /dev/null +++ b/test/model/admin/getsecretkey.php.bak @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getSecretKey(); +cid=1 +pid=1 + + + +*/ + +$admin = new adminTest(); + +r($admin->getSecretKeyTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/admin/getsignature.php b/test/model/admin/getsignature.php new file mode 100755 index 0000000000..b49acdb2ab --- /dev/null +++ b/test/model/admin/getsignature.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +getSignature(); +cid=1 +pid=1 + +正常测试 >> 1 + +*/ +$admin = new adminTest(); + +r($admin->getSignatureTest()) && p() && e('1'); //正常测试 \ No newline at end of file diff --git a/test/model/admin/getstatofcompany.php.bak b/test/model/admin/getstatofcompany.php.bak new file mode 100755 index 0000000000..b988fce125 --- /dev/null +++ b/test/model/admin/getstatofcompany.php.bak @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getStatOfCompany(); +cid=1 +pid=1 + + + +*/ + +$admin = new adminTest(); + +r($admin->getStatOfCompanyTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/admin/getstatofpms.php b/test/model/admin/getstatofpms.php new file mode 100755 index 0000000000..f039b99b87 --- /dev/null +++ b/test/model/admin/getstatofpms.php @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getStatOfPMS(); +cid=1 +pid=1 + +正常测试 >> 0 + +*/ + +$admin = new adminTest(); + +r($admin->getStatOfPMSTest()) && p() && e('0'); //正常测试 \ No newline at end of file diff --git a/test/model/admin/getstatofsys.php.bak b/test/model/admin/getstatofsys.php.bak new file mode 100755 index 0000000000..4316e5cc1f --- /dev/null +++ b/test/model/admin/getstatofsys.php.bak @@ -0,0 +1,19 @@ +#!/usr/bin/env php +getStatOfSys(); +cid=1 +pid=1 + + + +*/ + +$admin = new adminTest(); + +r($admin->getStatOfSysTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/admin/postapi.php.bak b/test/model/admin/postapi.php.bak new file mode 100755 index 0000000000..0bef9f9f5f --- /dev/null +++ b/test/model/admin/postapi.php.bak @@ -0,0 +1,20 @@ +#!/usr/bin/env php +postAPI(); +cid=1 +pid=1 + + + +*/ + +$admin = new adminTest(); + +a($admin->postAPITest());die; +r($admin->postAPITest()) && p() && e(); \ No newline at end of file diff --git a/test/model/admin/registerbyapi.php.bak b/test/model/admin/registerbyapi.php.bak new file mode 100755 index 0000000000..8b1a182acb --- /dev/null +++ b/test/model/admin/registerbyapi.php.bak @@ -0,0 +1,19 @@ +#!/usr/bin/env php +registerByAPI(); +cid=1 +pid=1 + + + +*/ + +$admin = new adminTest(); + +r($admin->registerByAPITest()) && p() && e(); \ No newline at end of file diff --git a/test/model/admin/sendcodebyapi.php.bak b/test/model/admin/sendcodebyapi.php.bak new file mode 100755 index 0000000000..a810fff39b --- /dev/null +++ b/test/model/admin/sendcodebyapi.php.bak @@ -0,0 +1,19 @@ +#!/usr/bin/env php +sendCodeByAPI(); +cid=1 +pid=1 + + + +*/ + +$admin = new adminTest(); + +r($admin->sendCodeByAPITest()) && p() && e(); \ No newline at end of file diff --git a/test/model/admin/setcompanybyapi.php.bak b/test/model/admin/setcompanybyapi.php.bak new file mode 100755 index 0000000000..8e8572f782 --- /dev/null +++ b/test/model/admin/setcompanybyapi.php.bak @@ -0,0 +1,19 @@ +#!/usr/bin/env php +setCompanyByAPI(); +cid=1 +pid=1 + + + +*/ + +$admin = new adminTest(); + +r($admin->setCompanyByAPITest()) && p() && e(); \ No newline at end of file diff --git a/test/ztest b/test/ztest index 02817f800b..ee415cc8a5 100755 --- a/test/ztest +++ b/test/ztest @@ -96,6 +96,9 @@ switch($argv[1]) break; case 'productsonplan': ztfRun('model/productsonplan'); + break;; + case 'admin': + ztfRun('model/admin'); break; case 'model': ztfRun('model');