+ [misc] Add unit tests for searchZen::setOptionAndOr() method

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liugang
2025-11-12 08:31:13 +08:00
co-authored by Claude
parent bc92e94f06
commit cf320466b0
2 changed files with 51 additions and 0 deletions
+13
View File
@@ -20,4 +20,17 @@ class searchZenTest extends baseTest
if(dao::isError()) return dao::getError();
return $result;
}
/**
* Test setOptionAndOr method.
*
* @access public
* @return mixed
*/
public function setOptionAndOrTest()
{
$result = $this->invokeArgs('setOptionAndOr');
if(dao::isError()) return dao::getError();
return $result;
}
}
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env php
<?php
/**
title=测试 searchZen::setOptionAndOr();
timeout=0
cid=0
- 执行$result1 @1
- 执行$result2 @2
- 执行$result3第0条的value属性 @and
- 执行$result4第0条的title属性 @并且
- 执行$result5第1条的value属性 @or
- 执行$result6第1条的title属性 @或者
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/zen.class.php';
su('admin');
$searchTest = new searchZenTest();
$result1 = $searchTest->setOptionAndOrTest();
$result2 = $searchTest->setOptionAndOrTest();
$result3 = $searchTest->setOptionAndOrTest();
$result4 = $searchTest->setOptionAndOrTest();
$result5 = $searchTest->setOptionAndOrTest();
$result6 = $searchTest->setOptionAndOrTest();
r(is_array($result1)) && p() && e('1');
r(count($result2)) && p() && e('2');
r($result3) && p('0:value') && e('and');
r($result4) && p('0:title') && e('并且');
r($result5) && p('1:value') && e('or');
r($result6) && p('1:title') && e('或者');