znt/module/caselib/test/model/isclickable.php

54 lines
2.1 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=测试 caselibModel::isClickable();
timeout=0
cid=15535
- 执行caselibTest模块的isClickableTest方法参数是$libObject, 'createcase' @1
- 执行caselibTest模块的isClickableTest方法参数是$libWithProduct, 'createcase' @0
- 执行caselibTest模块的isClickableTest方法参数是$emptyObject, 'createcase' @0
- 执行caselibTest模块的isClickableTest方法参数是$libObject, 'edit' @1
- 执行caselibTest模块的isClickableTest方法参数是$libObject, '' @1
- 执行caselibTest模块的isClickableTest方法参数是$libObject2, 'CREATECASE' @1
- 执行caselibTest模块的isClickableTest方法参数是$libObject, 'nonexistent' @1
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$caselibTest = new caselibModelTest();
// 测试步骤1测试createcase操作且对象有lib无product时是否可点击
$libObject = new stdclass();
$libObject->lib = 1;
r($caselibTest->isClickableTest($libObject, 'createcase')) && p() && e('1');
// 测试步骤2测试createcase操作且对象有lib有product时是否可点击
$libWithProduct = new stdclass();
$libWithProduct->lib = 1;
$libWithProduct->product = 1;
r($caselibTest->isClickableTest($libWithProduct, 'createcase')) && p() && e('0');
// 测试步骤3测试createcase操作且对象无lib属性时是否可点击
$emptyObject = new stdclass();
r($caselibTest->isClickableTest($emptyObject, 'createcase')) && p() && e('0');
// 测试步骤4测试普通操作edit在有权限时是否可点击
r($caselibTest->isClickableTest($libObject, 'edit')) && p() && e('1');
// 测试步骤5测试空字符串操作在有权限时是否可点击
r($caselibTest->isClickableTest($libObject, '')) && p() && e('1');
// 测试步骤6测试大小写混合操作CREATECASE时是否可点击
$libObject2 = new stdclass();
$libObject2->lib = 2;
r($caselibTest->isClickableTest($libObject2, 'CREATECASE')) && p() && e('1');
// 测试步骤7测试不存在的操作时权限检查
r($caselibTest->isClickableTest($libObject, 'nonexistent')) && p() && e('1');