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

33 lines
1.4 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::checkNavSubset();
timeout=0
cid=16695
- 步骤1空nav参数测试期望返回true @1
- 步骤2general nav且subset无配置期望返回true @1
- 步骤3general nav但subset配置为my期望返回false @0
- 步骤4nav与subset配置匹配期望返回true @1
- 步骤5nav与subset配置不匹配期望返回false @0
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
// 2. 用户登录
su('admin');
// 3. 创建测试实例(变量名与模块名一致)
$groupTest = new groupModelTest();
// 4. 强制要求必须包含至少5个测试步骤
r($groupTest->checkNavSubsetTest('', 'my')) && p() && e('1'); // 步骤1空nav参数测试期望返回true
r($groupTest->checkNavSubsetTest('general', 'noconfig')) && p() && e('1'); // 步骤2general nav且subset无配置期望返回true
r($groupTest->checkNavSubsetTest('general', 'my')) && p() && e('0'); // 步骤3general nav但subset配置为my期望返回false
r($groupTest->checkNavSubsetTest('my', 'my')) && p() && e('1'); // 步骤4nav与subset配置匹配期望返回true
r($groupTest->checkNavSubsetTest('product', 'my')) && p() && e('0'); // 步骤5nav与subset配置不匹配期望返回false