From 5180c287a18dab8eeda3dad99d617ccd8acff16c Mon Sep 17 00:00:00 2001 From: zhouxin Date: Thu, 3 Aug 2023 13:48:15 +0800 Subject: [PATCH] * Add unit test for metric. --- .../scale/scale_of_monthly_closed_story.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 module/metric/test/calc/global/scale/scale_of_monthly_closed_story.php diff --git a/module/metric/test/calc/global/scale/scale_of_monthly_closed_story.php b/module/metric/test/calc/global/scale/scale_of_monthly_closed_story.php new file mode 100644 index 0000000000..9dbdffa1b1 --- /dev/null +++ b/module/metric/test/calc/global/scale/scale_of_monthly_closed_story.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +config('product', $useCommon = true, $levels = 4)->gen(10); +zdTable('story')->config('story_status', $useCommon = true, $levels = 4)->gen(1000); + +$metric = new metricTest(); +$calc = $metric->calcMetric(__FILE__); + +/** + +title=scale_of_monthly_closed_story +timeout=0 +cid=1 + +*/ + +r(count($calc->getResult())) && p('') && e('50'); // 测试分组数 + +r($calc->getResult(array('year' => '2014', 'month' => '10'))) && p('0:value') && e('11'); // 测试2014年10月关闭的需求规模数 +r($calc->getResult(array('year' => '2017', 'month' => '02'))) && p('0:value') && e('4'); // 测试2017年2月关闭的需求规模数 +r($calc->getResult(array('year' => '2021', 'month' => '04'))) && p('') && e('0'); // 测试不存在的产品的需求规模数 +