feat : modification des exports PDF et affichage du type de contrat sur l'écran des heures
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
This commit is contained in:
@@ -94,6 +94,87 @@ final class EmployeeContractPeriodValidatorTest extends TestCase
|
||||
$this->validator->assertNextStartDateCompatible(new DateTimeImmutable('2026-03-10'), $currentPeriod);
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursAcceptsNullForStandardContract(): void
|
||||
{
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(35), ContractNature::CDI, null);
|
||||
self::assertTrue(true); // no exception
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursRejectsScheduleOn35hContract(): void
|
||||
{
|
||||
$this->expectException(UnprocessableEntityHttpException::class);
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(35), ContractNature::CDI, [1 => 120]);
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursRejectsScheduleOnForfaitContract(): void
|
||||
{
|
||||
$this->expectException(UnprocessableEntityHttpException::class);
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(null, Contract::TRACKING_PRESENCE), ContractNature::CDI, [1 => 120]);
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursAcceptsNullForInterim(): void
|
||||
{
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(4), ContractNature::INTERIM, null);
|
||||
self::assertTrue(true);
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursRequiresScheduleForCustomContract(): void
|
||||
{
|
||||
$this->expectException(UnprocessableEntityHttpException::class);
|
||||
$this->expectExceptionMessage('workDaysHours is required');
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(4), ContractNature::CDI, null);
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursRequiresScheduleForCustomContractOnEmptyArray(): void
|
||||
{
|
||||
$this->expectException(UnprocessableEntityHttpException::class);
|
||||
$this->expectExceptionMessage('workDaysHours is required');
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(4), ContractNature::CDI, []);
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursRejectsIsoOutsideOneToFive(): void
|
||||
{
|
||||
$this->expectException(UnprocessableEntityHttpException::class);
|
||||
$this->expectExceptionMessage('iso weekdays 1-5');
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(4), ContractNature::CDI, [6 => 120, 7 => 120]);
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursRejectsIsoZero(): void
|
||||
{
|
||||
$this->expectException(UnprocessableEntityHttpException::class);
|
||||
$this->expectExceptionMessage('iso weekdays 1-5');
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(4), ContractNature::CDI, [0 => 240]);
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursRejectsNegativeMinutes(): void
|
||||
{
|
||||
$this->expectException(UnprocessableEntityHttpException::class);
|
||||
$this->expectExceptionMessage('non-negative integer minutes');
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(4), ContractNature::CDI, [1 => -120, 4 => 360]);
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursRejectsSumMismatch(): void
|
||||
{
|
||||
$this->expectException(UnprocessableEntityHttpException::class);
|
||||
$this->expectExceptionMessage('total must equal contract weekly hours');
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(4), ContractNature::CDI, [1 => 60, 4 => 60]);
|
||||
}
|
||||
|
||||
public function testAssertWorkDaysHoursAcceptsValidScheduleFor4hContract(): void
|
||||
{
|
||||
$this->validator->assertWorkDaysHours($this->buildContract(4), ContractNature::CDI, [1 => 120, 4 => 120]);
|
||||
self::assertTrue(true);
|
||||
}
|
||||
|
||||
private function buildContract(?int $weeklyHours, string $trackingMode = Contract::TRACKING_TIME): Contract
|
||||
{
|
||||
return new Contract()
|
||||
->setName('Test')
|
||||
->setTrackingMode($trackingMode)
|
||||
->setWeeklyHours($weeklyHours)
|
||||
;
|
||||
}
|
||||
|
||||
private function buildCurrentPeriod(string $startDate, ?string $endDate): EmployeeContractPeriod
|
||||
{
|
||||
$contract = new Contract()
|
||||
|
||||
Reference in New Issue
Block a user