znt/module/editor/test/model/getparam.php

30 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=测试 editorModel::getParam();
timeout=0
cid=16238
- 测试获取控制器方法参数(包含默认值)
- 属性params @$date=\'today\'
- 测试获取模型方法参数无默认值属性params @$todo
- 测试获取不存在的方法参数属性hasError @1
- 测试不同数据类型的默认值处理属性params @$userID
- 测试带有多个参数的方法属性hasComma @1
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$editor = new editorModelTest();
r($editor->getParamTest('todo', 'create', '')) && p('params') && e('$date=\'today\', $from=\'todo\''); // 测试获取控制器方法参数(包含默认值)
r($editor->getParamTest('todo', 'create', 'Model')) && p('params') && e('$todo'); // 测试获取模型方法参数(无默认值)
r($editor->getParamTest('todo', 'nonExistentMethod', '')) && p('hasError') && e('1'); // 测试获取不存在的方法参数
r($editor->getParamTest('user', 'view', '')) && p('params') && e('$userID'); // 测试不同数据类型的默认值处理
r($editor->getParamTest('todo', 'create', '')) && p('hasComma') && e('1'); // 测试带有多个参数的方法