Merge branch 'master' into 'sprint/hufangzhou_user_unit'
# Conflicts: # test/class/user.class.php
This commit is contained in:
@@ -13,6 +13,34 @@ class executionTest
|
||||
$this->objectModel = $tester->loadModel('execution');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test save state.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param array $executions
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function saveStateTest($executionID = 0, $executions = array())
|
||||
{
|
||||
return $this->objectModel->saveState($executionID, $executions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the select code of executions.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $currentModule
|
||||
* @param string $currentMethod
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function selectTest($executionID, $currentModule, $currentMethod)
|
||||
{
|
||||
$executions = $this->objectModel->getPairs();
|
||||
return $this->objectModel->select($executions, $executionID, 0, $currentModule, $currentMethod);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the privilege.
|
||||
*
|
||||
@@ -371,7 +399,7 @@ class executionTest
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairsTest($projectID,$count)
|
||||
public function getPairsTest($projectID, $count)
|
||||
{
|
||||
$object = $this->objectModel->getPairs($projectID);
|
||||
|
||||
@@ -2408,4 +2436,17 @@ class executionTest
|
||||
global $lang;
|
||||
return strip_tags($lang->switcherMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get switcher.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSwitcherTest($executionID = 0, $method = '')
|
||||
{
|
||||
return $this->objectModel->getSwitcher($executionID, 'execution', $method);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,7 +587,8 @@ class userTest
|
||||
$contacts = $this->objectModel->getContactLists($account, $params);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
return $contacts;
|
||||
|
||||
return $contacts ? $contacts : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1081,4 +1082,26 @@ class userTest
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify user by PHP_AUTH_USER.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function identifyByPhpAuthTest()
|
||||
{
|
||||
return $this->objectModel->identifyByPhpAuth();
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify user by cookie.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function identifyByCookieTest()
|
||||
{
|
||||
return $this->objectModel->identifyByCookie();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试executionModel->getTreeTest();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
敏捷执行关闭 >> status,wait,getTreed
|
||||
瀑布执行关闭 >> status,doing,getTreed
|
||||
看板执行关闭 >> status,doing,getTreed
|
||||
不输入实际完成时间校验 >> 『realEnd』不能为空。
|
||||
|
||||
*/
|
||||
|
||||
$executionIDList = array('101','131', '161');
|
||||
$count = array('0','1');
|
||||
|
||||
$execution = new executionTest();
|
||||
var_dump($execution->getTreeTest($executionIDList[0],$count[0]));die;
|
||||
r($execution->getTreeTest($executionIDList[0],$count[0])) && p('91') && e('0,101,102'); // 敏捷项目下根据执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[1],$count[0])) && p('46') && e('0,11,12'); // 瀑布项目下根据执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[2],$count[0])) && p('57') && e('0,33,34'); // 看板项目下根据执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[3],$count[0])) && p('21') && e('0'); // 非分支产品执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[0],$count[1])) && p() && e('3'); // 敏捷执行关联产品分支统计
|
||||
r($execution->getTreeTest($executionIDList[1],$count[1])) && p() && e('2'); // 瀑布执行关联产品分支统计
|
||||
r($execution->getTreeTest($executionIDList[2],$count[1])) && p() && e('2'); // 看板执行关联产品分支统计
|
||||
r($execution->getTreeTest($executionIDList[3],$count[1])) && p() && e('2'); // 正常产品分支统计
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试executionModel->getTreeTest();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
敏捷执行关闭 >> status,wait,getTreed
|
||||
瀑布执行关闭 >> status,doing,getTreed
|
||||
看板执行关闭 >> status,doing,getTreed
|
||||
不输入实际完成时间校验 >> 『realEnd』不能为空。
|
||||
|
||||
*/
|
||||
|
||||
$executionIDList = array('101','131', '161');
|
||||
$count = array('0','1');
|
||||
|
||||
$execution = new executionTest();
|
||||
var_dump($execution->getTreeTest($executionIDList[0],$count[0]));die;
|
||||
r($execution->getTreeTest($executionIDList[0],$count[0])) && p('91') && e('0,101,102'); // 敏捷项目下根据执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[1],$count[0])) && p('46') && e('0,11,12'); // 瀑布项目下根据执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[2],$count[0])) && p('57') && e('0,33,34'); // 看板项目下根据执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[3],$count[0])) && p('21') && e('0'); // 非分支产品执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[0],$count[1])) && p() && e('3'); // 敏捷执行关联产品分支统计
|
||||
r($execution->getTreeTest($executionIDList[1],$count[1])) && p() && e('2'); // 瀑布执行关联产品分支统计
|
||||
r($execution->getTreeTest($executionIDList[2],$count[1])) && p() && e('2'); // 看板执行关联产品分支统计
|
||||
r($execution->getTreeTest($executionIDList[3],$count[1])) && p() && e('2'); // 正常产品分支统计
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('项目集1,项目1,迭代1,阶段1,看板1');
|
||||
$execution->type->range('program,project,sprint,stage,kanban');
|
||||
$execution->parent->range('0,1,2{3}');
|
||||
$execution->status->range('wait{3},suspended,closed,doing');
|
||||
$execution->openedBy->range('admin,user1');
|
||||
$execution->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
su('admin');
|
||||
/**
|
||||
|
||||
title=测试 executionModel::saveState();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
查看传入空返回的下拉菜单 >> 执行
|
||||
查看传入id=1, 请求all方法的执行返回的下拉菜单 >> 0
|
||||
查看传入id=1,请求tasks方法的执行返回的下拉菜单 >> 项目集1
|
||||
|
||||
*/
|
||||
$methods = array('all', 'task');
|
||||
|
||||
$executionTester = new executionTest();
|
||||
$switcher1 = $executionTester->getSwitcherTest(0);
|
||||
$switcher2 = $executionTester->getSwitcherTest(1, $methods[0]);
|
||||
$switcher3 = $executionTester->getSwitcherTest(1, $methods[1]);
|
||||
|
||||
r(strip_tags($switcher1)) && p() && e('执行'); // 查看传入空返回的下拉菜单
|
||||
r(strip_tags($switcher2)) && p() && e('0'); // 查看传入id=1, 请求all方法的执行返回的下拉菜单
|
||||
r(strip_tags($switcher3)) && p() && e('项目集1'); // 查看传入id=1,请求tasks方法的执行返回的下拉菜单
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试executionModel->getTreeTest();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
敏捷执行关闭 >> status,wait,getTreed
|
||||
瀑布执行关闭 >> status,doing,getTreed
|
||||
看板执行关闭 >> status,doing,getTreed
|
||||
不输入实际完成时间校验 >> 『realEnd』不能为空。
|
||||
|
||||
*/
|
||||
|
||||
$executionIDList = array('101','131', '161');
|
||||
$count = array('0','1');
|
||||
|
||||
$execution = new executionTest();
|
||||
var_dump($execution->getTreeTest($executionIDList[0],$count[0]));die;
|
||||
r($execution->getTreeTest($executionIDList[0],$count[0])) && p('91') && e('0,101,102'); // 敏捷项目下根据执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[1],$count[0])) && p('46') && e('0,11,12'); // 瀑布项目下根据执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[2],$count[0])) && p('57') && e('0,33,34'); // 看板项目下根据执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[3],$count[0])) && p('21') && e('0'); // 非分支产品执行查询产品分支
|
||||
r($execution->getTreeTest($executionIDList[0],$count[1])) && p() && e('3'); // 敏捷执行关联产品分支统计
|
||||
r($execution->getTreeTest($executionIDList[1],$count[1])) && p() && e('2'); // 瀑布执行关联产品分支统计
|
||||
r($execution->getTreeTest($executionIDList[2],$count[1])) && p() && e('2'); // 看板执行关联产品分支统计
|
||||
r($execution->getTreeTest($executionIDList[3],$count[1])) && p() && e('2'); // 正常产品分支统计
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1,2,3');
|
||||
$execution->name->range('执行1,执行2,执行3');
|
||||
$execution->type->range('sprint');
|
||||
$execution->grade->range('1');
|
||||
$execution->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(3);
|
||||
|
||||
/**
|
||||
|
||||
title=测试executionModel->saveState();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
执行ID存在但无权访问 >> html
|
||||
执行ID不存在 >> 0
|
||||
执行ID存在,但不在可以查看的执行列表 >> 1
|
||||
执行ID存在,且在可以查看的执行列表 >> 2
|
||||
执行ID不存在,且有可以查看的执行列表 >> 2
|
||||
|
||||
*/
|
||||
|
||||
$executionTester = new executionTest();
|
||||
ob_start();
|
||||
$executionTester->saveStateTest(1);
|
||||
$execution1 = ob_get_clean();
|
||||
$execution2 = $executionTester->saveStateTest(0);
|
||||
$execution3 = $executionTester->saveStateTest(1, array(1 => ''));
|
||||
$execution4 = $executionTester->saveStateTest(3, array(2 => ''));
|
||||
$execution5 = $executionTester->saveStateTest(0, array(2 => ''));
|
||||
|
||||
r(substr($execution1, 1, 4)) && p() && e('html'); // 执行ID存在但无权访问
|
||||
r($execution2) && p() && e('0'); // 执行ID不存在
|
||||
r($execution3) && p() && e('1'); // 执行ID存在,但不在可以查看的执行列表
|
||||
r($execution4) && p() && e('2'); // 执行ID存在,且在可以查看的执行列表
|
||||
r($execution5) && p() && e('2'); // 执行ID不存在,且有可以查看的执行列表
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('项目集1,项目1,迭代1,阶段1,看板1');
|
||||
$execution->type->range('execution,project,sprint,stage,kanban');
|
||||
$execution->parent->range('0,1,2{3}');
|
||||
$execution->status->range('wait{3},suspended,closed,doing');
|
||||
$execution->openedBy->range('admin,user1');
|
||||
$execution->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 executionModel::select();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
检查下拉菜单默认选中迭代1 >> 迭代1
|
||||
|
||||
*/
|
||||
|
||||
$executionTester = new executionTest();
|
||||
$html = $executionTester->selectTest('3', 'execution', 'all');
|
||||
|
||||
r(strip_tags($html)) && p() && e('迭代1'); // 检查下拉菜单默认选中迭代1
|
||||
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
zdTable('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$execution = zdTable('project');
|
||||
$execution->id->range('1-5');
|
||||
$execution->name->range('项目集1,项目1,迭代1,阶段1,看板1');
|
||||
$execution->type->range('execution,project,sprint,stage,kanban');
|
||||
$execution->parent->range('0,1,2{3}');
|
||||
$execution->status->range('wait{3},suspended,closed,doing');
|
||||
$execution->openedBy->range('admin,user1');
|
||||
$execution->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD');
|
||||
$execution->gen(5);
|
||||
|
||||
$product = zdTable('product');
|
||||
$product->id->range('1-2');
|
||||
$product->name->range('正常产品1,多分支产品1');
|
||||
$product->type->range('normal,branch');
|
||||
$product->status->range('normal');
|
||||
$product->createdBy->range('admin,user1');
|
||||
$product->gen(2);
|
||||
|
||||
$branch = zdTable('branch');
|
||||
$branch->id->range('1-2');
|
||||
$branch->product->range('2');
|
||||
$branch->name->range('分支1,分支2');
|
||||
$branch->status->range('active');
|
||||
$branch->gen(2);
|
||||
|
||||
$projectProduct = zdTable('projectproduct');
|
||||
$projectProduct->project->range('3{3}, 4{3}, 5{3}');
|
||||
$projectProduct->product->range('1-2{2}');
|
||||
$projectProduct->branch->range('0-2');
|
||||
$projectProduct->gen(9);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 executionModel::tree();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
检查执行列表的树状结构 >> 正常产品1
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
$treeHtml = $tester->loadModel('execution')->tree();
|
||||
|
||||
r(strip_tags($treeHtml)) && p() && e('正常产品1'); // 检查执行列表的树状结构
|
||||
@@ -4,19 +4,32 @@ include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
|
||||
su('admin');
|
||||
|
||||
$userContactList = zdTable('usercontact');
|
||||
$userContactList->gen(100);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 userModel::getContactLists();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取user1的联系人列表,取出空对应的值 >> 联系人
|
||||
获取dev2的联系人列表,判断空对应的值是否为空 >> 1
|
||||
获取test3的联系人列表的总数 >> 3
|
||||
获取admin的联系人列表 >> 0
|
||||
获取空用户的联系人列表 >> 0
|
||||
|
||||
*/
|
||||
$user = new userTest();
|
||||
$adminContactList1 = $user->getContactListsTest('admin', 'withempty|withnote');
|
||||
$adminContactList2 = $user->getContactListsTest('admin', '');
|
||||
$test2ContactList = $user->getContactListsTest('test2');
|
||||
$emptyContactList = $user->getContactListsTest('', '');
|
||||
|
||||
r($adminContactList) && p() && e('0'); // 获取admin的联系人列表
|
||||
$user = new userTest();
|
||||
$user1ContactList = $user->getContactListsTest('user1', 'withempty|withnote');
|
||||
$dev2ContactList = $user->getContactListsTest('dev2', 'withempty');
|
||||
$test3ContactList = $user->getContactListsTest('test3');
|
||||
$adminContactList = $user->getContactListsTest('admin');
|
||||
$emptyContactList = $user->getContactListsTest('');
|
||||
|
||||
r($user1ContactList['']) && p() && e('联系人'); // 获取user1的联系人列表,取出空对应的值
|
||||
r($dev2ContactList[''] === '') && p() && e('1'); // 获取dev2的联系人列表,判断空对应的值是否为空
|
||||
r(count($test3ContactList)) && p() && e('3'); // 获取test3的联系人列表的总数
|
||||
r($adminContactList) && p() && e('0'); // 获取admin的联系人列表
|
||||
r($emptyContactList) && p() && e('0'); // 获取空用户的联系人列表
|
||||
|
||||
@@ -4,6 +4,9 @@ include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
|
||||
su('admin');
|
||||
|
||||
$userContactList = zdTable('usercontact');
|
||||
$userContactList->gen(100);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 userModel::getListByAccount();
|
||||
@@ -11,15 +14,16 @@ cid=1
|
||||
pid=1
|
||||
|
||||
获取admin的联系人列表 >> 0
|
||||
获取admin的联系人列表 >> 0
|
||||
获取admin的联系人列表 >> 0
|
||||
获取dev2的联系人列表 >> 3
|
||||
获取空用户的联系人列表 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$user = new userTest();
|
||||
$adminContactList = $user->getListByAccountTest('admin');
|
||||
$test2ContactList = $user->getListByAccountTest('test2');
|
||||
$test2ContactList = $user->getListByAccountTest('dev2');
|
||||
$emptyContactList = $user->getListByAccountTest('');
|
||||
|
||||
r($adminContactList) && p() && e('0'); // 获取admin的联系人列表
|
||||
r($test2ContactList) && p() && e('0'); // 获取admin的联系人列表
|
||||
r($emptyContactList) && p() && e('0'); // 获取admin的联系人列表
|
||||
r(count($adminContactList)) && p() && e('0'); // 获取admin的联系人列表
|
||||
r(count($test2ContactList)) && p() && e('3'); // 获取dev2的联系人列表
|
||||
r(count($emptyContactList)) && p() && e('0'); // 获取空用户的联系人列表
|
||||
|
||||
@@ -4,21 +4,22 @@ include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
|
||||
su('admin');
|
||||
|
||||
$userView = zdTable('userview');
|
||||
$userView->gen(400);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 userModel::getParentStageAuthedUsers();
|
||||
title=测试 userModel->getParentStageAuthedUsers();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
传入ID为0的情况获取有权限的用户 >> 0
|
||||
传入一个阶段ID获取有权限的用户 >> admin
|
||||
传入一个阶段ID获取有权限的用户 >> dev12
|
||||
传入一个项目集ID获取有权限的用户 >> 0
|
||||
传入一个看板类型的项目ID获取有权限的用户 >> admin
|
||||
|
||||
*/
|
||||
$user = new userTest();
|
||||
|
||||
r($user->getParentStageAuthedUsersTest(0)) && p() && e('0'); //传入ID为0的情况获取有权限的用户
|
||||
r($user->getParentStageAuthedUsersTest(131)) && p('admin') && e('admin'); //传入一个阶段ID获取有权限的用户
|
||||
r($user->getParentStageAuthedUsersTest(1)) && p() && e('0'); //传入一个项目集ID获取有权限的用户
|
||||
r($user->getParentStageAuthedUsersTest(161)) && p('admin') && e('admin'); //传入一个看板类型的项目ID获取有权限的用户
|
||||
r($user->getParentStageAuthedUsersTest(0)) && p() && e('0'); //传入阶段ID为0获取有权限的用户
|
||||
r($user->getParentStageAuthedUsersTest(212)) && p('dev12') && e('dev12'); //传入一个阶段ID为212获取有权限的用户
|
||||
r($user->getParentStageAuthedUsersTest(1)) && p() && e('0'); //传入一个阶段ID为1获取有权限的用户
|
||||
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
$user = zdTable('user');
|
||||
$user->gen(300);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 userModel->identifyByCookie();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
验证admin用户 >> 1
|
||||
验证游客用户 >> 0
|
||||
获取不存在的用户 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$user = new userTest();
|
||||
|
||||
$_COOKIE['za'] = 'admin';
|
||||
$_COOKIE['zp'] = 'a0933c1218a4e745bacdcf572b10eba7';
|
||||
$normalUser = $user->identifyByCookieTest('admin');
|
||||
|
||||
$_COOKIE['za'] = 'guest';
|
||||
$_COOKIE['zp'] = '';
|
||||
$guest = $user->identifyByCookieTest('guest');
|
||||
|
||||
$_COOKIE['za'] = 'asdqwe';
|
||||
$_COOKIE['zp'] = 'a0933c1218a4e745bacdcf572b10eba7';
|
||||
$notExistUser = $user->identifyByCookieTest('asdqwe');
|
||||
|
||||
r($normalUser) && p() && e('1'); //验证admin用户
|
||||
r($guest) && p() && e('0'); //验证游客用户
|
||||
r($notExistsUser) && p() && e('0'); //获取不存在的用户
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
$user = zdTable('user');
|
||||
$user->gen(300);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 userModel->identifyByPhpAuth();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
验证admin用户 >> 1
|
||||
验证游客用户 >> 0
|
||||
获取不存在的用户 >> 0
|
||||
|
||||
*/
|
||||
|
||||
$user = new userTest();
|
||||
|
||||
$_SERVER['PHP_AUTH_USER'] = 'admin';
|
||||
$_SERVER['PHP_AUTH_PW'] = 'a0933c1218a4e745bacdcf572b10eba7';
|
||||
$normalUser = $user->identifyByPhpAuthTest('admin');
|
||||
|
||||
$_SERVER['PHP_AUTH_USER'] = 'guest';
|
||||
$_SERVER['PHP_AUTH_PW'] = '';
|
||||
$guest = $user->identifyByPhpAuthTest('guest');
|
||||
|
||||
$_SERVER['PHP_AUTH_USER'] = 'asdqwe';
|
||||
$_SERVER['PHP_AUTH_PW'] = 'a0933c1218a4e745bacdcf572b10eba7';
|
||||
$notExistUser = $user->identifyByPhpAuthTest('asdqwe');
|
||||
|
||||
r($normalUser) && p() && e('1'); //验证admin用户
|
||||
r($guest) && p() && e('0'); //验证游客用户
|
||||
r($notExistsUser) && p() && e('0'); //获取不存在的用户
|
||||
Reference in New Issue
Block a user