[#SIRH-36] corriger calcule rtt contrat custom #27

Merged
tristan merged 16 commits from feature/SIRH-36-corriger-le-calcule-des-rtt-des-contrat-4h into develop 2026-06-11 08:36:57 +00:00
Showing only changes of commit f344eb536c - Show all commits
@@ -80,6 +80,23 @@ final class RttClosingBalanceServiceTest extends TestCase
);
}
public function testCustomDeficitWeekReducesClosingBalance(): void
{
// CUSTOM (4h) : une semaine de récup +3h puis une semaine déficitaire -1h
// (toutes deux sans tranches 25/50). Le déficit doit réduire la clôture.
$recovery = new WeekRecoveryDetail(totalMinutes: 180, isFlatRecovery: true); // +3h
$deficit = new WeekRecoveryDetail(totalMinutes: -60, isFlatRecovery: true); // -1h
$closing = $this->service()->fold(new WeekRecoveryDetail(), [$recovery, $deficit], $this->payments());
// 3h - 1h = 2h reportées, et la somme des buckets égale toujours le total.
self::assertSame(120, $closing->totalMinutes);
self::assertSame(
120,
$closing->base25Minutes + $closing->bonus25Minutes + $closing->base50Minutes + $closing->bonus50Minutes,
);
}
public function testBucketSumAlwaysEqualsTotalInvariant(): void
{
$opening = new WeekRecoveryDetail(base25Minutes: 200, bonus25Minutes: 50, base50Minutes: 100, bonus50Minutes: 50, totalMinutes: 400);