invert = 1; return [ [ $date, PeriodDesignationEnum::WEEKLY(), $work_days, $total_hours, $overtime, [ 'period' => '2020#49', 'periodDesignation' => 'weekly', 'workingDays' => 15, 'totalHours' => '32:22:00', 'overtime' => '00:22:00' ], ], [ $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', 'workingDays' => 15, 'totalHours' => '32:22:00', 'overtime' => '00:22:00' ], ], [ $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, 'totalHours' => '32:22:00', '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' ], ], ]; } /** * @param DateTimeInterface $period * @param PeriodDesignationEnum $periodDesignation * @param int $workingDays * @param DateInterval $totalHours * @param DateInterval $overtime * @param array $should_json * * @dataProvider workingHoursProvider */ public function testWorkingHoursViewWithContent( DateTimeInterface $period, PeriodDesignationEnum $periodDesignation, int $workingDays, DateInterval $totalHours, DateInterval $overtime, array $should_json ): void { $obj = new WorkingHoursView($period, $periodDesignation, $workingDays, $totalHours, $overtime); $this->assertNotNull($obj->getPeriod()); $this->assertInstanceOf(DateTimeInterface::class, $obj->getPeriod()); $this->assertEquals($period, $obj->getPeriod()); $this->assertNotNull($obj->getPeriodDesignation()); $this->assertInstanceOf(PeriodDesignationEnum::class, $obj->getPeriodDesignation()); $this->assertEquals($periodDesignation, $obj->getPeriodDesignation()); $this->assertNotNull($obj->getWorkingDays()); $this->assertIsInt($obj->getWorkingDays()); $this->assertEquals($workingDays, $obj->getWorkingDays()); $this->assertNotNull($obj->getTotalHours()); $this->assertInstanceOf(DateInterval::class, $obj->getTotalHours()); $this->assertEquals($totalHours, $obj->getTotalHours()); $this->assertNotNull($obj->getOvertime()); $this->assertInstanceOf(DateInterval::class, $obj->getOvertime()); $this->assertEquals($overtime, $obj->getOvertime()); $json = $obj->jsonSerialize(); $this->assertIsArray($json); $this->assertEquals($should_json, $json); } }