49 lines
1.8 KiB
PHP
Executable file
49 lines
1.8 KiB
PHP
Executable file
#!/usr/bin/env php
|
|
<?php
|
|
|
|
/**
|
|
|
|
title=测试 searchTao::replaceDynamic();
|
|
timeout=0
|
|
cid=18343
|
|
|
|
- 测试替换 $lastWeek @1
|
|
- 测试替换 $thisWeek @1
|
|
- 测试替换 $lastMonth @1
|
|
- 测试替换 $thisMonth @1
|
|
- 测试替换 $yesterday @1
|
|
- 测试替换 $today @1
|
|
- 测试替换me @`account = 'admin'`
|
|
- 测试不包含$变量的查询 @title like 'normal query'
|
|
|
|
*/
|
|
|
|
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
|
include dirname(__FILE__, 2) . '/lib/tao.class.php';
|
|
|
|
su('admin');
|
|
|
|
// 准备测试数据
|
|
$queryList = array();
|
|
$queryList[] = "date between '\$lastWeek'";
|
|
$queryList[] = "date between '\$thisWeek'";
|
|
$queryList[] = "date between '\$lastMonth'";
|
|
$queryList[] = "date between '\$thisMonth'";
|
|
$queryList[] = "date between '\$yesterday'";
|
|
$queryList[] = "date between '\$today'";
|
|
$queryList[] = "account = '\$@me'";
|
|
$queryList[] = "title like 'normal query'";
|
|
|
|
// 创建测试实例
|
|
$search = new searchTaoTest();
|
|
|
|
// 执行测试步骤
|
|
r($search->replaceDynamicTest($queryList[0])) && p() && e('1'); // 测试替换 $lastWeek
|
|
r($search->replaceDynamicTest($queryList[1])) && p() && e('1'); // 测试替换 $thisWeek
|
|
r($search->replaceDynamicTest($queryList[2])) && p() && e('1'); // 测试替换 $lastMonth
|
|
r($search->replaceDynamicTest($queryList[3])) && p() && e('1'); // 测试替换 $thisMonth
|
|
r($search->replaceDynamicTest($queryList[4])) && p() && e('1'); // 测试替换 $yesterday
|
|
r($search->replaceDynamicTest($queryList[5])) && p() && e('1'); // 测试替换 $today
|
|
r($search->replaceDynamicTest($queryList[6])) && p() && e("`account = 'admin'`"); // 测试替换me
|
|
r($search->replaceDynamicTest($queryList[7])) && p() && e("title like 'normal query'"); // 测试不包含$变量的查询
|