znt/module/zahost/test/model/ping.php

29 lines
911 B
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=测试 zahostModel::ping();
timeout=0
cid=19754
- 步骤1测试本地回环地址 @yes
- 步骤2测试localhost域名 @yes
- 步骤3测试无效IP格式 @no
- 步骤4测试不可达IP地址 @no
- 步骤5测试空字符串输入 @no
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$zahost = new zahostModelTest();
r($zahost->pingTest('127.0.0.1')) && p() && e('yes'); // 步骤1测试本地回环地址
r($zahost->pingTest('localhost')) && p() && e('yes'); // 步骤2测试localhost域名
r($zahost->pingTest('invalid.ip.format')) && p() && e('no'); // 步骤3测试无效IP格式
r($zahost->pingTest('10.0.0.222')) && p() && e('no'); // 步骤4测试不可达IP地址
r($zahost->pingTest('')) && p() && e('no'); // 步骤5测试空字符串输入