* Refactor holidayModel::updateProgramPlanDuration, and modify its unit test.

This commit is contained in:
liumengyi
2023-12-04 15:31:54 +08:00
parent 6525a165f6
commit d6537f77bf
4 changed files with 96 additions and 32 deletions
@@ -1,7 +1,13 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/holiday.class.php';
zdTable('holiday')->gen(10);
zdTable('project')->config('execution')->gen(5);
zdTable('user')->gen(1);
su('admin');
/**
@@ -10,30 +16,21 @@ title=测试 holidayModel->updateProgramPlanDuration();
cid=1
pid=1
测试插入id为1的节假日时迭代101项目的planDuration >> 59
测试插入id为3的节假日时迭代101项目的planDuration >> 59
测试插入id为1的节假日时迭代102项目的planDuration >> 58
测试插入id为3的节假日时迭代102项目的planDuration >> 58
测试插入id为1的节假日时迭代750项目的planDuration >> 58
测试插入id为3的节假日时迭代750项目的planDuration >> 58
测试插入id为1的节假日时迭代1项目的planDuration >> 59
测试插入id为3的节假日时迭代1项目的planDuration >> 59
测试插入id为1的节假日时迭代11项目的planDuration >> 59
测试插入id为3的节假日时迭代11项目的planDuration >> 59
*/
$holidayIDList = array('1', '3', '99', '100');
$holidayIdList = array(10, 5, 1);
$projectIdList = array(11, 61, 101);
$updateDuration = array(true, false);
$holiday = new holidayTest();
r($holiday->updateProgramPlanDurationTest(101, $holidayIDList[0])) && p() && e('59'); //测试插入id为1的节假日时迭代101项目的planDuration
r($holiday->updateProgramPlanDurationTest(101, $holidayIDList[1])) && p() && e('59'); //测试插入id为3的节假日时迭代101项目的planDuration
r($holiday->updateProgramPlanDurationTest(102, $holidayIDList[0])) && p() && e('58'); //测试插入id为1的节假日时迭代102项目的planDuration
r($holiday->updateProgramPlanDurationTest(102, $holidayIDList[1])) && p() && e('58'); //测试插入id为3的节假日时迭代102项目的planDuration
r($holiday->updateProgramPlanDurationTest(750, $holidayIDList[0])) && p() && e('58'); //测试插入id为1的节假日时迭代750项目的planDuration
r($holiday->updateProgramPlanDurationTest(750, $holidayIDList[1])) && p() && e('58'); //测试插入id为3的节假日时迭代750项目的planDuration
r($holiday->updateProgramPlanDurationTest(1, $holidayIDList[0])) && p() && e('59'); //测试插入id为1的节假日时迭代1项目的planDuration
r($holiday->updateProgramPlanDurationTest(1, $holidayIDList[1])) && p() && e('59'); //测试插入id为3的节假日时迭代1项目的planDuration
r($holiday->updateProgramPlanDurationTest(11, $holidayIDList[0])) && p() && e('59'); //测试插入id为1的节假日时迭代11项目的planDuration
r($holiday->updateProgramPlanDurationTest(11, $holidayIDList[1])) && p() && e('59'); //测试插入id为3的节假日时迭代11项目的planDuration
r($holiday->updateProgramPlanDurationTest($projectIdList[0], $holidayIdList[0], $updateDuration[0])) && p() && e('58'); //测试插入id为 10 的节假日时迭代 11 项目的planDuration
r($holiday->updateProgramPlanDurationTest($projectIdList[1], $holidayIdList[0], $updateDuration[1])) && p() && e('58'); //测试插入id为 10 的节假日时迭代 60 项目的planDuration
r($holiday->updateProgramPlanDurationTest($projectIdList[2], $holidayIdList[0], $updateDuration[1])) && p() && e('59'); //测试插入id为 10 的节假日时迭代 101 项目的planDuration
r($holiday->updateProgramPlanDurationTest($projectIdList[0], $holidayIdList[1], $updateDuration[0])) && p() && e('58'); //测试插入id为 5 的节假日时迭代 11 项目的planDuration
r($holiday->updateProgramPlanDurationTest($projectIdList[1], $holidayIdList[1], $updateDuration[1])) && p() && e('58'); //测试插入id为 5 的节假日时迭代 60 项目的planDuration
r($holiday->updateProgramPlanDurationTest($projectIdList[2], $holidayIdList[1], $updateDuration[1])) && p() && e('59'); //测试插入id为 5 的节假日时迭代 101 项目的planDuration
r($holiday->updateProgramPlanDurationTest($projectIdList[0], $holidayIdList[2], $updateDuration[0])) && p() && e('58'); //测试插入id为 5 的节假日时迭代 11 项目的planDuration
r($holiday->updateProgramPlanDurationTest($projectIdList[1], $holidayIdList[2], $updateDuration[1])) && p() && e('58'); //测试插入id为 5 的节假日时迭代 60 项目的planDuration
r($holiday->updateProgramPlanDurationTest($projectIdList[2], $holidayIdList[2], $updateDuration[1])) && p() && e('59'); //测试插入id为 5 的节假日时迭代 101 项目的planDuration