znt/module/common/test/model/canoperateeffort.php

49 lines
1.5 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试 commonModel::canOperateEffort();
timeout=0
cid=15651
- 步骤1管理员用户可以操作任何日志 @1
- 步骤2空effort对象的处理 @1
- 步骤3用户可以操作自己的日志 @1
- 步骤4用户不能操作他人的日志无权限 @0
- 步骤5项目负责人可以操作团队成员日志 @1
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$commonTest = new commonModelTest();
$effort1 = new stdclass();
$effort1->account = 'user1';
$effort1->project = 1;
$effort1->execution = 1;
$emptyEffort = new stdclass();
$effort3 = new stdclass();
$effort3->account = 'admin';
$effort4 = new stdclass();
$effort4->account = 'user2';
$effort4->project = 2;
$effort4->execution = 2;
$effort5 = new stdclass();
$effort5->account = 'user1';
$effort5->project = 1;
$effort5->execution = 1;
r($commonTest->canOperateEffortTest($effort1)) && p() && e('1'); // 步骤1管理员用户可以操作任何日志
r($commonTest->canOperateEffortTest($emptyEffort)) && p() && e('1'); // 步骤2空effort对象的处理
r($commonTest->canOperateEffortTest($effort3)) && p() && e('1'); // 步骤3用户可以操作自己的日志
r($commonTest->canOperateEffortTest($effort4)) && p() && e('0'); // 步骤4用户不能操作他人的日志无权限
r($commonTest->canOperateEffortTest($effort5)) && p() && e('1'); // 步骤5项目负责人可以操作团队成员日志