From 735b195c06cbaef4c977b6732fa205232aa1ca21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20L=C3=BCcke?= Date: Thu, 15 Apr 2021 11:34:04 +0200 Subject: [PATCH] Die Tests hatten nicht die richtige Darstellung von negativen Werten getestet. --- .../unit/Models/WorkingHoursViewTest.php | 52 +++++++++++++------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/api/tests/unit/Models/WorkingHoursViewTest.php b/api/tests/unit/Models/WorkingHoursViewTest.php index d26c055..cf0a0db 100644 --- a/api/tests/unit/Models/WorkingHoursViewTest.php +++ b/api/tests/unit/Models/WorkingHoursViewTest.php @@ -17,13 +17,15 @@ class WorkingHoursViewTest extends Unit */ public function workingHoursProvider(): array { + $date = new DateTime('2020-11-30'); + $work_days = 15; + $total_hours = new DateInterval("PT32H22M"); + $overtime = new DateInterval("PT22M"); + $absence_time = clone $overtime; + $absence_time->invert = 1; return [ [ - new DateTime('2020-11-30'), - PeriodDesignationEnum::WEEKLY(), - 15, - new DateInterval("PT32H22M"), - new DateInterval("PT22M"), + $date, PeriodDesignationEnum::WEEKLY(), $work_days, $total_hours, $overtime, [ 'period' => '2020#49', 'periodDesignation' => 'weekly', @@ -33,11 +35,17 @@ class WorkingHoursViewTest extends Unit ], ], [ - new DateTime('2020-11-30'), - PeriodDesignationEnum::MONTHLY(), - 15, - new DateInterval("PT32H22M"), - new DateInterval("PT22M"), + $date, PeriodDesignationEnum::WEEKLY(), $work_days, $total_hours, $absence_time, + [ + 'period' => '2020#49', + 'periodDesignation' => 'weekly', + 'workingDays' => 15, + 'totalHours' => '32:22:00', + 'overtime' => '-00:22:00' + ], + ], + [ + $date, PeriodDesignationEnum::MONTHLY(), $work_days, $total_hours, $overtime, [ 'period' => '2020-11', 'periodDesignation' => 'monthly', @@ -47,12 +55,17 @@ class WorkingHoursViewTest extends Unit ], ], [ - new DateTime('2020-11-30'), - PeriodDesignationEnum::YEARLY(), - 15, - new DateInterval("PT32H22M"), - new DateInterval("PT22M"), + $date, PeriodDesignationEnum::MONTHLY(), $work_days, $total_hours, $absence_time, [ + 'period' => '2020-11', + 'periodDesignation' => 'monthly', + 'workingDays' => 15, + 'totalHours' => '32:22:00', + 'overtime' => '-00:22:00' + ], + ], + [ + $date, PeriodDesignationEnum::YEARLY(), $work_days, $total_hours, $overtime, [ 'period' => '2020', 'periodDesignation' => 'yearly', 'workingDays' => 15, @@ -60,6 +73,15 @@ class WorkingHoursViewTest extends Unit 'overtime' => '00:22:00' ], ], + [ + $date, PeriodDesignationEnum::YEARLY(), $work_days, $total_hours, $absence_time, [ + 'period' => '2020', + 'periodDesignation' => 'yearly', + 'workingDays' => 15, + 'totalHours' => '32:22:00', + 'overtime' => '-00:22:00' + ], + ], ]; }