assertEquals($expectedMinutes, $converter->convertIntoWorkDuration( Duration::parse($duration), LocalTime::parse($startWorkday), LocalTime::parse($endWorkday), $date )->duration->toMinutes()); } /** * @return array> */ public static function durationsProvider(): array { return [ [(1.5 + 24) * 60, 'P0DT3H', '08:00', '09:30', '08:00'], // 1.5 hours and one day (half work per day) [(24 * 2 + 1) * 60, 'P0DT3H', '08:00', '09:00', '08:00'], // 1 hour and two days (1/3 per day) [3 * 24 * 60 + 30, 'P0DT3H30M', '08:00', '09:00', '8:00'], // full 3 days and 30M [3 * 60, 'P0DT3H', '08:00', '16:00', '08:00'], // 3 hours [4 * 60, 'P0DT4H', '08:00', '16:00', '08:00'], // 4 hours [8 * 60, 'P0DT8H', '08:00', '16:00', '08:00'], // 8 hours (one full day) [24 * 60 + 2, 'P0DT8H2M', '08:00', '16:00', '08:00'], // 8 hours and 2 minutes (one full day and 2 minutes) [24 * 60 + 1, 'P0DT0H2M', '08:00', '16:00', '15:59'] // 1 minute first day, one minute second day because startTime ]; } }