[#SIRH] RTT: proratiser le plafond 25%/50% pour les embauches en milieu de semaine
Le seuil de départ du +25% était proratisé aux jours contractés, mais le plafond 25%/50% restait codé en dur à 43h: pour une embauche en milieu de semaine, toutes les heures supp tombaient en 25%, jamais en 50%. Le plafond vaut désormais seuil_départ_proraté + largeur de bande +25% (4h pour un 39h, 8h pour un 35h). Semaine pleine: plafond = 43h (inchangé). Témoin Dylan (CDD 39h embauché jeudi, 22h): 4h à 25% + 3h à 50%. Écran Heures (WorkHourWeeklySummaryProvider) laissé tel quel (décision métier). Suppression de deux helpers morts (computeOvertime25/50BonusMinutes) du service. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -67,6 +67,52 @@ final class RttRecoveryComputationServiceTest extends TestCase
|
||||
self::assertSame('2026-03-16', $anchor);
|
||||
}
|
||||
|
||||
public function testResolveOvertime25BandWidthIs4hForH39(): void
|
||||
{
|
||||
$service = new ReflectionClass(RttRecoveryComputationService::class)->newInstanceWithoutConstructor();
|
||||
$contract = new Contract()->setWeeklyHours(39);
|
||||
|
||||
self::assertSame(4 * 60, $this->invokePrivate($service, 'resolveOvertime25BandWidthMinutes', $contract));
|
||||
}
|
||||
|
||||
public function testResolveOvertime25BandWidthIs8hForH35(): void
|
||||
{
|
||||
$service = new ReflectionClass(RttRecoveryComputationService::class)->newInstanceWithoutConstructor();
|
||||
$contract = new Contract()->setWeeklyHours(35);
|
||||
|
||||
self::assertSame(8 * 60, $this->invokePrivate($service, 'resolveOvertime25BandWidthMinutes', $contract));
|
||||
}
|
||||
|
||||
/**
|
||||
* Dylan Chaboisson, semaine 12 : embauché le jeudi sur un contrat 39h.
|
||||
* Total travaillé 22h (1320 min), départ 25 % proraté aux jours contractés = 15h (900 min),
|
||||
* plafond 25 %/50 % = 15h + bande 4h = 19h (1140 min). Le plafond se décale avec
|
||||
* l'embauche au lieu de rester bloqué à 43h, ouvrant la tranche 50 %.
|
||||
*/
|
||||
public function testMidWeekHireSplitsOvertimeAcross25And50(): void
|
||||
{
|
||||
$service = new ReflectionClass(RttRecoveryComputationService::class)->newInstanceWithoutConstructor();
|
||||
|
||||
[$base25, $base50] = $this->invokePrivate($service, 'computeOvertimeBaseMinutes', 1320, 900, 1140);
|
||||
|
||||
self::assertSame(4 * 60, $base25);
|
||||
self::assertSame(3 * 60, $base50);
|
||||
}
|
||||
|
||||
/**
|
||||
* Régression : semaine pleine 39h (départ 39h, plafond 43h), 46h travaillées →
|
||||
* 4h à 25 % (39→43) et 3h à 50 % (43→46), comportement inchangé.
|
||||
*/
|
||||
public function testFullWeekOvertimeSplitUnchanged(): void
|
||||
{
|
||||
$service = new ReflectionClass(RttRecoveryComputationService::class)->newInstanceWithoutConstructor();
|
||||
|
||||
[$base25, $base50] = $this->invokePrivate($service, 'computeOvertimeBaseMinutes', 2760, 2340, 2580);
|
||||
|
||||
self::assertSame(4 * 60, $base25);
|
||||
self::assertSame(3 * 60, $base50);
|
||||
}
|
||||
|
||||
private function invokePrivate(object $obj, string $method, mixed ...$args): mixed
|
||||
{
|
||||
return new ReflectionClass($obj::class)->getMethod($method)->invoke($obj, ...$args);
|
||||
|
||||
Reference in New Issue
Block a user