znt/module/block/test/zen/isexternalcall.php

46 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=测试 blockZen::isExternalCall();
timeout=0
cid=15245
- 步骤1无hash参数时期望返回false @0
- 步骤2有hash参数时期望返回true @1
- 步骤3hash参数为空字符串期望返回true @1
- 步骤4hash参数为0期望返回true @1
- 步骤5同时存在多个GET参数期望返回true @1
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/zen.class.php';
// 2. 用户登录(选择合适角色)
su('admin');
// 3. 创建测试实例
$blockTest = new blockZenTest();
// 4. 测试步骤 - 必须包含至少5个测试步骤
// 清空$_GET参数确保测试环境干净
$_GET = array();
r($blockTest->isExternalCallTest()) && p() && e('0'); // 步骤1无hash参数时期望返回false
$_GET['hash'] = 'test123';
r($blockTest->isExternalCallTest()) && p() && e('1'); // 步骤2有hash参数时期望返回true
$_GET['hash'] = '';
r($blockTest->isExternalCallTest()) && p() && e('1'); // 步骤3hash参数为空字符串期望返回true
$_GET['hash'] = '0';
r($blockTest->isExternalCallTest()) && p() && e('1'); // 步骤4hash参数为0期望返回true
$_GET['hash'] = 'abc123';
$_GET['other'] = 'value';
r($blockTest->isExternalCallTest()) && p() && e('1'); // 步骤5同时存在多个GET参数期望返回true