* Test setQuery.

This commit is contained in:
daitingting
2023-11-30 03:20:20 +00:00
parent ed43e30f80
commit 4e1bac7334
2 changed files with 41 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/search.class.php';
su('admin');
zdTable('userquery')->gen(10);
/**
title=测试 searchModel->setSearchParams();
timeout=0
cid=1
- queryID 为 0 时,返回 1 = 1 @1 = 1
- 查询ID为1的搜索条件名称及查询数量 @(( 1 AND `name` LIKE '%aa%' ) AND ( 1 )) AND deleted = '0'
*/
$search = new searchTest();
$queryIDList = array('0', '1', '2', '3', '4', '5', '6');
$module = 'task';
r($search->setQueryTest($module, $queryIDList[0])) && p('') && e('1 = 1'); // queryID 为 0 时,返回 1 = 1
r($search->setQueryTest($module, $queryIDList[1])) && p('') && e("(( 1 AND `name` LIKE '%aa%' ) AND ( 1 )) AND deleted = '0'"); //查询ID为1的搜索条件名称及查询数量
+14
View File
@@ -115,6 +115,20 @@ class searchTest
return $query;
}
/**
* 测试设置查询语句。
* Set query test.
*
* @param string $module
* @param int $queryID
* @access public
* @return string
*/
public function setQueryTest(string $module, int $queryID): string
{
return $this->objectModel->setQuery($module, $queryID);
}
/**
* Test get by ID.
*