test(rtt) : custom deficit week reduces closing balance
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user