Merge branch 'autotest_ly' into 'master'
update task data and add admin of test See merge request easycorp/zentaopms!3022
This commit is contained in:
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
class adminTest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $tester;
|
||||
global $config;
|
||||
global $app;
|
||||
$this->objectModel = $tester->loadModel('admin');
|
||||
$this->user = $tester->loadModel('user');
|
||||
$this->communityConfig = $app->loadConfig('community');
|
||||
$this->adminConfig = $config->admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post data form API.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $formvars
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function postAPITest()
|
||||
{
|
||||
$apiConfig = $this->objectModel->getApiConfig();
|
||||
$apiURL = $this->adminConfig->apiRoot . "/user-apiRegister.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest&{$apiConfig->sessionVar}={$apiConfig->sessionID}";
|
||||
|
||||
$objects = $this->objectModel->postAPI($apiURL);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get status of zentaopms.
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function getStatOfPMSTest()
|
||||
{
|
||||
$objects = $this->objectModel->getStatOfPMS();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getStatOfCompanyTest($companyID)
|
||||
{
|
||||
$objects = $this->objectModel->getStatOfCompany($companyID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getStatOfSysTest()
|
||||
{
|
||||
$objects = $this->objectModel->getStatOfSys();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function registerByAPITest()
|
||||
{
|
||||
$objects = $this->objectModel->registerByAPI();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Login zentao by API.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function bindByAPITest($param)
|
||||
{
|
||||
$_POST = $param;
|
||||
$objects = $this->objectModel->bindByAPI();
|
||||
$objects = json_decode($objects);
|
||||
unset($_POST);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function getSecretKeyTest()
|
||||
{
|
||||
$objects = $this->objectModel->getSecretKey();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function sendCodeByAPITest($type)
|
||||
{
|
||||
$objects = $this->objectModel->sendCodeByAPI($type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function certifyByAPITest($type)
|
||||
{
|
||||
$objects = $this->objectModel->certifyByAPI($type);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
public function setCompanyByAPITest()
|
||||
{
|
||||
$objects = $this->objectModel->setCompanyByAPI();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get signature.
|
||||
*
|
||||
* @param array $params
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getSignatureTest()
|
||||
{
|
||||
$params['u'] = $this->communityConfig;
|
||||
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequet';
|
||||
|
||||
$apiConfig = $this->objectModel->getApiConfig();
|
||||
$params[$apiConfig->sessionVar] = $apiConfig->sessionID;
|
||||
|
||||
$objects = $this->objectModel->getSignature($params);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
if($objects){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getApiConfigTest()
|
||||
{
|
||||
$objects = $this->objectModel->getApiConfig();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get register information.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getRegisterInfoTest()
|
||||
{
|
||||
$objects = $this->objectModel->getRegisterInfo();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
/**
|
||||
* Check weak.
|
||||
*
|
||||
* @param object $user
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
public function checkWeakTest($account)
|
||||
{
|
||||
$user = $this->user->getById($account);
|
||||
$objects = $this->objectModel->checkWeak($user);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
@@ -185,8 +185,7 @@ fields:
|
||||
format: ""
|
||||
- field: assignedTo
|
||||
note: "指派给"
|
||||
from: common.user.v1.yaml
|
||||
use: user
|
||||
range: ""
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
|
||||
+1
-2
@@ -185,8 +185,7 @@ fields:
|
||||
format: ""
|
||||
- field: assignedTo
|
||||
note: "指派给"
|
||||
from: common.user.v1.yaml
|
||||
use: user
|
||||
range: ""
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -185,8 +185,7 @@ fields:
|
||||
format: ""
|
||||
- field: assignedTo
|
||||
note: "指派给"
|
||||
from: common.user.v1.yaml
|
||||
use: user
|
||||
range: po82,user92
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->bindByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> success;wxm11,j8a5qCRTleJh9Gv4
|
||||
错误密码测试 >> fail;登录失败,请检查您的用户名或密码是否填写正确。
|
||||
post数据为空测试 >> fail;登录失败,请检查您的用户名或密码是否填写正确。
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
$paramInfo = array('account' => 'wxm11', 'password' => '123qweasd', 'sn' => 'c8aa3269e181f2b9258ce96625de1497', 'site' => 'http://zentaopmsdemo.com');
|
||||
$errorPwd = array('account' => 'wxm11', 'password' => '123', 'sn' => 'c8aa3269e181f2b9258ce96625de1497', 'site' => 'http://zentaopmsdemo.com');
|
||||
$emptyPost = array();
|
||||
|
||||
r($admin->bindByAPITest($errorPwd)) && p('result;message') && e('fail;登录失败,请检查您的用户名或密码是否填写正确。'); //错误密码测试
|
||||
r($admin->bindByAPITest($emptyPost)) && p('result;message') && e('fail;登录失败,请检查您的用户名或密码是否填写正确。'); //post数据为空测试
|
||||
r($admin->bindByAPITest($paramInfo)) && p('result;data:account,private') && e('success;wxm11,j8a5qCRTleJh9Gv4'); //正常测试
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->certifyByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->certifyByAPITest()) && p() && e();
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->checkWeak();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> 0
|
||||
|
||||
*/
|
||||
$account = 'admin';
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->checkWeakTest($account)) && p() && e('0'); //正常测试
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getApiConfig();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getApiConfigTest()) && p() && e();
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getRegisterInfo();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> 易软天创网络科技有限公司
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getRegisterInfoTest()) && p('company') && e('易软天创网络科技有限公司'); //正常测试
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getSecretKey();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getSecretKeyTest()) && p() && e();
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getSignature();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> 1
|
||||
|
||||
*/
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getSignatureTest()) && p() && e('1'); //正常测试
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getStatOfCompany();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getStatOfCompanyTest()) && p() && e();
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getStatOfPMS();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
正常测试 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getStatOfPMSTest()) && p() && e('0'); //正常测试
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->getStatOfSys();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->getStatOfSysTest()) && p() && e();
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->postAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
a($admin->postAPITest());die;
|
||||
r($admin->postAPITest()) && p() && e();
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->registerByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->registerByAPITest()) && p() && e();
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->sendCodeByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->sendCodeByAPITest()) && p() && e();
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/admin.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 adminModel->setCompanyByAPI();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
$admin = new adminTest();
|
||||
|
||||
r($admin->setCompanyByAPITest()) && p() && e();
|
||||
@@ -96,6 +96,9 @@ switch($argv[1])
|
||||
break;
|
||||
case 'productsonplan':
|
||||
ztfRun('model/productsonplan');
|
||||
break;;
|
||||
case 'admin':
|
||||
ztfRun('model/admin');
|
||||
break;
|
||||
case 'model':
|
||||
ztfRun('model');
|
||||
|
||||
Reference in New Issue
Block a user