feat(leave) : resolve phase immediately preceding a given phase

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-20 16:09:54 +02:00
parent 7570b3b19f
commit ffa185dc5d
2 changed files with 44 additions and 0 deletions

View File

@@ -247,6 +247,31 @@ final class EmployeeLeaveSummaryProviderTest extends TestCase
self::assertFalse($this->invokePrivate($provider, 'isForfaitEntryYear', $h39Phase, 2026));
}
public function testResolvePhaseImmediatelyBeforeReturnsPriorH39Phase(): void
{
$employee = $this->buildEmployeeWithTransition('2020-06-01', '2026-04-30', '2026-05-01');
$phases = new EmployeeContractPhaseResolver()->resolvePhases($employee);
$forfaitPhase = $phases[0]; // current FORFAIT
$h39Phase = $phases[1];
$provider = $this->buildProvider();
$prior = $this->invokePrivate($provider, 'resolvePhaseImmediatelyBefore', $employee, $forfaitPhase);
self::assertNotNull($prior);
self::assertSame($h39Phase->id, $prior->id);
self::assertSame(ContractType::H39, $prior->contractType);
}
public function testResolvePhaseImmediatelyBeforeReturnsNullForFirstPhase(): void
{
$employee = $this->buildEmployeeWithTransition('2020-06-01', '2026-04-30', '2026-05-01');
$phases = new EmployeeContractPhaseResolver()->resolvePhases($employee);
$firstPhase = $phases[1]; // the H39 (earliest)
$provider = $this->buildProvider();
self::assertNull($this->invokePrivate($provider, 'resolvePhaseImmediatelyBefore', $employee, $firstPhase));
}
public function testNonForfaitPhaseStartingMidExerciseUsesFullExerciseFromAsStart(): void
{
// Scenario: 35h CDI from 2014-07-01 to 2025-10-31, then 39h CDI from 2025-11-01.