From 25dc4cf4122ae79edeeda78c9847210cb56c8c27 Mon Sep 17 00:00:00 2001 From: liugang Date: Fri, 3 Oct 2025 06:54:08 +0800 Subject: [PATCH] * [misc] Fix unit tests for searchTao::markKeywords() method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- module/search/test/tao/markkeywords.php | 31 +++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/module/search/test/tao/markkeywords.php b/module/search/test/tao/markkeywords.php index f2f2124acc..7c5fde84b8 100755 --- a/module/search/test/tao/markkeywords.php +++ b/module/search/test/tao/markkeywords.php @@ -1,28 +1,29 @@ #!/usr/bin/env php test content -- 执行searchTest模块的markKeywordsDirectTest方法,参数是'This contains key1 and key2 words', 'key1 key2' @This contains key1 and key2 words -- 执行searchTest模块的markKeywordsDirectTest方法,参数是'这是一个测试内容', '测试' @这是一个测试 内容 -- 执行searchTest模块的markKeywordsDirectTest方法,参数是'Product version 12345 released', '12345' @Product version 12345 released -- 执行searchTest模块的markKeywordsDirectTest方法,参数是'No keywords here', '' @No keywords here +- 测试简单文本中单个关键词标记 @This is a test content +- 测试文本中多个关键词标记 @This contains key1 and key2 words +- 测试中文文本中关键词标记 @这是一个测试 内容 +- 测试数字关键词标记 @Product version 12345 released +- 测试空关键词情况 @No keywords here */ +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/search.unittest.class.php'; + +su('admin'); + $searchTest = new searchTest(); -r($searchTest->markKeywordsDirectTest('This is a test content', 'test')) && p() && e("This is a test content "); -r($searchTest->markKeywordsDirectTest('This contains key1 and key2 words', 'key1 key2')) && p() && e("This contains key1 and key2 words "); -r($searchTest->markKeywordsDirectTest('这是一个测试内容', '测试')) && p() && e("这是一个测试 内容 "); -r($searchTest->markKeywordsDirectTest('Product version 12345 released', '12345')) && p() && e("Product version 12345 released "); -r($searchTest->markKeywordsDirectTest('No keywords here', '')) && p() && e('No keywords here'); \ No newline at end of file +r($searchTest->markKeywordsDirectTest('This is a test content', 'test')) && p() && e("This is a test content "); +r($searchTest->markKeywordsDirectTest('This contains key1 and key2 words', 'key1 key2')) && p() && e("This contains key1 and key2 words "); +r($searchTest->markKeywordsDirectTest('这是一个测试内容', '测试')) && p() && e("这是一个测试 内容 "); +r($searchTest->markKeywordsDirectTest('Product version 12345 released', '12345')) && p() && e("Product version 12345 released "); +r($searchTest->markKeywordsDirectTest('No keywords here', '')) && p() && e('No keywords here '); \ No newline at end of file