From 86b31411e1da5e948e7398b01b90baa886019c73 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 20 Nov 2025 13:35:56 +0800 Subject: [PATCH] * [unittest] add test method for formatExportData. --- module/product/test/lib/zen.class.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/module/product/test/lib/zen.class.php b/module/product/test/lib/zen.class.php index 43fdf532f6..e632371786 100644 --- a/module/product/test/lib/zen.class.php +++ b/module/product/test/lib/zen.class.php @@ -2842,4 +2842,30 @@ class productZenTest extends baseTest if(dao::isError()) return dao::getError(); return array('productID' => $productID, 'branch' => $branch, 'projectID' => $projectID, 'executionSuccess' => $executionSuccess); } + + /** + * 格式化导出数据。 + * Format export data. + * + * @param array $products + * @access public + * @return array + */ + public function formatExportDataTest(array $dataList = array()): array + { + $this->instance->app->rawModule = 'product'; + + $products = array(); + foreach($dataList as $data) + { + $product = new stdclass(); + foreach($data as $key => $value) $product->$key = $value; + $products[] = $product; + } + + $result = $this->invokeArgs('formatExportData', [$products]); + if(dao::isError()) return dao::getError(); + + return $result; + } }