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

33 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=测试 commonModel::checkSafeFile();
timeout=0
cid=15663
- 步骤1容器环境返回false @0
- 步骤2有效安全文件返回false @0
- 步骤3upgrade模块升级中返回false @0
- 步骤4无安全文件返回路径 @1
- 步骤5安全文件过期返回路径 @1
*/
// 1. 导入依赖
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
// 2. 用户登录
su('admin');
// 3. 创建测试实例
$commonTest = new commonModelTest();
// 4. 执行测试步骤
r($commonTest->checkSafeFileTest('inContainer')) && p() && e('0'); // 步骤1容器环境返回false
r($commonTest->checkSafeFileTest('validSafeFile')) && p() && e('0'); // 步骤2有效安全文件返回false
r($commonTest->checkSafeFileTest('upgradeModule')) && p() && e('0'); // 步骤3upgrade模块升级中返回false
r(strpos($commonTest->checkSafeFileTest('noSafeFile'), 'ok.txt') !== false) && p() && e('1'); // 步骤4无安全文件返回路径
r(strpos($commonTest->checkSafeFileTest('expiredSafeFile'), 'ok.txt') !== false) && p() && e('1'); // 步骤5安全文件过期返回路径