fix(leave) : forfait work-target ignores bonus/fractioned days
The header target subtracted summary.acquiredDays, which includes fractionedDays (and bonusDays via the full-year acquired), so a full-year forfait with weekend work or HR fractioned days showed <218. Full year = contractual 218 (capped at period business days); entry year = businessDays − entry acquired (repos + carried CP, excluding bonus/fractioned). Extracted computeForfaitWorkTargetDays + 3 tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,34 @@ final class EmployeeLeaveSummaryProviderTest extends TestCase
|
||||
self::assertEqualsWithDelta(25.0 / 12.0, $result, 0.0001);
|
||||
}
|
||||
|
||||
public function testComputeForfaitWorkTargetDaysEntryYearProrates(): void
|
||||
{
|
||||
$provider = new ReflectionClass(EmployeeLeaveSummaryProvider::class)->newInstanceWithoutConstructor();
|
||||
|
||||
// Grégory : 168 jours ouvrés sur la période − 12.94 congés acquis (repos + CP reportés) ≈ 155.06
|
||||
$result = $this->invokePrivate($provider, 'computeForfaitWorkTargetDays', 168, true, 12.94);
|
||||
|
||||
self::assertEqualsWithDelta(155.06, $result, 0.001);
|
||||
}
|
||||
|
||||
public function testComputeForfaitWorkTargetDaysFullYearIs218IgnoringBonusAndFractioned(): void
|
||||
{
|
||||
$provider = new ReflectionClass(EmployeeLeaveSummaryProvider::class)->newInstanceWithoutConstructor();
|
||||
|
||||
// Année pleine : la cible reste 218 quelle que soit la valeur des congés acquis
|
||||
// (les bonus week-end/férié et jours fractionnés ne réduisent pas la cible).
|
||||
self::assertSame(218.0, $this->invokePrivate($provider, 'computeForfaitWorkTargetDays', 252, false, 34.0));
|
||||
self::assertSame(218.0, $this->invokePrivate($provider, 'computeForfaitWorkTargetDays', 252, false, 40.0));
|
||||
}
|
||||
|
||||
public function testComputeForfaitWorkTargetDaysFullYearCapsAtBusinessDaysWhenFewer(): void
|
||||
{
|
||||
$provider = new ReflectionClass(EmployeeLeaveSummaryProvider::class)->newInstanceWithoutConstructor();
|
||||
|
||||
// Période avec moins de 218 jours ouvrés (phase forfait clôturée en cours d'année) → cap aux jours ouvrés.
|
||||
self::assertSame(200.0, $this->invokePrivate($provider, 'computeForfaitWorkTargetDays', 200, false, 5.0));
|
||||
}
|
||||
|
||||
public function testComputeProratedForfaitRepoDaysGregoryCase(): void
|
||||
{
|
||||
$provider = new ReflectionClass(EmployeeLeaveSummaryProvider::class)->newInstanceWithoutConstructor();
|
||||
|
||||
Reference in New Issue
Block a user