znt/module/convert/test/model/dbexists.php

33 lines
1.1 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=测试 convertModel::dbExists();
timeout=0
cid=15769
- 步骤1检查方法是否存在 @1
- 步骤2检查方法是否可调用 @1
- 步骤3测试空数据库名称 @0
- 步骤4测试无效数据库名称数字开头 @0
- 步骤5测试无效数据库名称特殊字符 @0
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
global $tester;
$tester->loadModel('convert');
$convertTest = new convertModelTest();
r(method_exists($convertTest->instance, 'dbExists')) && p() && e('1'); // 步骤1检查方法是否存在
r(is_callable(array($convertTest->instance, 'dbExists'))) && p() && e('1'); // 步骤2检查方法是否可调用
r($convertTest->dbExistsTest('')) && p() && e('0'); // 步骤3测试空数据库名称
r($convertTest->dbExistsTest('123invalid')) && p() && e('0'); // 步骤4测试无效数据库名称数字开头
r($convertTest->dbExistsTest('test-db')) && p() && e('0'); // 步骤5测试无效数据库名称特殊字符