[#SIRH-36] corriger calcule rtt contrat custom (#27)
Auto Tag Develop / tag (push) Successful in 7s

| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|                  |                 |

## Description de la PR

## Modification du .env

## Check list

- [ ] Pas de régression
- [ ] TU/TI/TF rédigée
- [ ] TU/TI/TF OK
- [ ] CHANGELOG modifié

Reviewed-on: #27
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #27.
This commit is contained in:
2026-06-11 08:36:57 +00:00
committed by Autin
parent 081d92b9f4
commit f0387233e4
20 changed files with 1997 additions and 57 deletions
@@ -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);