From 940fd9361eab616880125e3d6389aa8766840206 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Fri, 22 Aug 2025 14:06:40 +0800 Subject: [PATCH] * Optimize converthtmlspecialchars unit test script. --- .../test/model/converthtmlspecialchars.php | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/module/product/test/model/converthtmlspecialchars.php b/module/product/test/model/converthtmlspecialchars.php index 98d91100c1..7f5a319725 100755 --- a/module/product/test/model/converthtmlspecialchars.php +++ b/module/product/test/model/converthtmlspecialchars.php @@ -4,11 +4,14 @@ /** title=测试productModel->convertHtmlSpecialChars(); +timeout=0 cid=0 - 不传入任何数据。 @0 - 检查转换后的产品名称。 @a's product - 检查转换后的项目名称。 @"b" project +- 检查转换后的项目名称。 @"b" project +- 检查转换后的项目名称。 @"
b
" project - 检查转换后的计划名称。 @a's plan */ @@ -16,23 +19,27 @@ include dirname(__FILE__, 5) . '/test/lib/init.php'; global $tester; $productModel = $tester->loadModel('product'); - -$productLink = '/product-browse-%s.html'; -$planLink = '/programplan-browse-%s-%s.html'; - r($productModel->convertHtmlSpecialChars(array())) && p() && e('0'); //不传入任何数据。 -$data['productList']['15'] = new stdclass(); -$data['productList']['15']->id = 15; -$data['productList']['15']->name = htmlspecialchars ("a's product"); -$data['projectList']['23'] = new stdclass(); -$data['projectList']['23']->id = 23; -$data['projectList']['23']->name = htmlspecialchars ('"b" project'); -$data['planList'][15][30] = new stdclass(); -$data['planList'][15][30]->id = 30; -$data['planList'][15][30]->title = htmlspecialchars ("a's plan"); +$data['productList']['1'] = new stdclass(); +$data['productList']['1']->id = 1; +$data['productList']['1']->name = htmlspecialchars("a's product"); +$data['projectList']['2'] = new stdclass(); +$data['projectList']['2']->id = 2; +$data['projectList']['2']->name = htmlspecialchars('"b" project'); +$data['projectList']['3'] = new stdclass(); +$data['projectList']['3']->id = 3; +$data['projectList']['3']->name = htmlspecialchars('"b" project'); +$data['projectList']['4'] = new stdclass(); +$data['projectList']['4']->id = 4; +$data['projectList']['4']->name = htmlspecialchars('"
b
" project'); +$data['planList'][1][1] = new stdclass(); +$data['planList'][1][1]->id = 1; +$data['planList'][1][1]->title = htmlspecialchars("a's plan"); $convertedData = $productModel->convertHtmlSpecialChars($data); -r($convertedData['productList'][15]->name) && p() && e("a's product"); //检查转换后的产品名称。 -r($convertedData['projectList'][23]->name) && p() && e('"b" project'); //检查转换后的项目名称。 -r($convertedData['planList'][15][30]->title) && p() && e("a's plan"); //检查转换后的计划名称。 +r($convertedData['productList'][1]->name) && p() && e("a's product"); //检查转换后的产品名称。 +r($convertedData['projectList'][2]->name) && p() && e('"b" project'); //检查转换后的项目名称。 +r($convertedData['projectList'][3]->name) && p() && e(`"b" project`); //检查转换后的项目名称。 +r($convertedData['projectList'][4]->name) && p() && e(`"
b
" project`); //检查转换后的项目名称。 +r($convertedData['planList'][1][1]->title) && p() && e("a's plan"); //检查转换后的计划名称。