znt/module/group/test/model/getprivsbyparents.php

29 lines
1.2 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=测试 groupModel::getPrivsByParents();
timeout=0
cid=16712
- 步骤1获取 my 子集的权限属性my-index @地盘仪表盘
- 步骤2获取 todo 子集的权限属性todo-create @添加待办
- 步骤3获取 product 子集的权限属性product-view @产品概况
- 步骤4获取 my 子集指定包的权限属性my-index @地盘仪表盘
- 步骤5测试不存在的子集 @0
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$groupTest = new groupModelTest();
r($groupTest->getPrivsByParentsTest('my', '')) && p('my-index') && e('地盘仪表盘'); // 步骤1获取 my 子集的权限
r($groupTest->getPrivsByParentsTest('todo', '')) && p('todo-create') && e('添加待办'); // 步骤2获取 todo 子集的权限
r($groupTest->getPrivsByParentsTest('product', '')) && p('product-view') && e('产品概况'); // 步骤3获取 product 子集的权限
r($groupTest->getPrivsByParentsTest('my', '|my|')) && p('my-index') && e('地盘仪表盘'); // 步骤4获取 my 子集指定包的权限
r(count($groupTest->getPrivsByParentsTest('nonexistent', ''))) && p() && e('0'); // 步骤5测试不存在的子集