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

28 lines
904 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=测试 commonModel::printMainMenu();
timeout=0
cid=15697
- 验证方法存在 @1
- 验证为静态方法 @1
- 验证为公共方法 @1
- 验证参数个数 @1
- 验证返回字符串类型 @1
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
su('admin');
// 5个测试步骤使用反射检查方法属性
r(method_exists('commonModel', 'printMainMenu')) && p() && e('1'); // 验证方法存在
$reflection = new ReflectionMethod('commonModel', 'printMainMenu');
r($reflection->isStatic() ? '1' : '0') && p() && e('1'); // 验证为静态方法
r($reflection->isPublic() ? '1' : '0') && p() && e('1'); // 验证为公共方法
r($reflection->getNumberOfParameters()) && p() && e('1'); // 验证参数个数
r($reflection->hasReturnType() && $reflection->getReturnType()->getName() == 'string' ? '1' : '0') && p() && e('1'); // 验证返回字符串类型