feat(overtime-contingent) : heures supp structurelles (>35h) ajoutées au contingent
Auto Tag Develop / tag (push) Successful in 6s
Auto Tag Develop / tag (push) Successful in 6s
Les heures contractuelles au-delà de 35h (ex. 39h → 17,33h décimales = 17h20/mois) sont payées chaque mois sans transiter par les paiements RTT (référence 39h). Elles manquaient au contingent. Ajout via StructuralOvertimeContingentCalculator : (weeklyHours-35)×260 min/mois, généralisé aux contrats non-forfait/non-intérim >35h, proratisé aux jours sous contrat. Branché sur l'encart fiche et l'export PDF. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,11 +4,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Service\WorkHours;
|
||||
|
||||
use App\Entity\Contract;
|
||||
use App\Entity\Employee;
|
||||
use App\Entity\EmployeeContractPeriod;
|
||||
use App\Entity\EmployeeRttPayment;
|
||||
use App\Enum\TrackingMode;
|
||||
use App\Repository\EmployeeRttPaymentRepository;
|
||||
use App\Service\WorkHours\OvertimeContingentExportBuilder;
|
||||
use App\Service\WorkHours\OvertimePaidContingentCalculator;
|
||||
use App\Service\WorkHours\StructuralOvertimeContingentCalculator;
|
||||
use DateTimeImmutable;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ReflectionProperty;
|
||||
|
||||
@@ -41,7 +46,7 @@ final class OvertimeContingentExportBuilderTest extends TestCase
|
||||
$repo = $this->createStub(EmployeeRttPaymentRepository::class);
|
||||
$repo->method('findByEmployeesAndYears')->willReturn([$payment]);
|
||||
|
||||
$builder = new OvertimeContingentExportBuilder($repo, new OvertimePaidContingentCalculator());
|
||||
$builder = new OvertimeContingentExportBuilder($repo, new OvertimePaidContingentCalculator(), new StructuralOvertimeContingentCalculator());
|
||||
|
||||
$rows = $builder->buildRows([$driverEmp], 2026);
|
||||
|
||||
@@ -64,7 +69,7 @@ final class OvertimeContingentExportBuilderTest extends TestCase
|
||||
$repo = $this->createStub(EmployeeRttPaymentRepository::class);
|
||||
$repo->method('findByEmployeesAndYears')->willReturn([]);
|
||||
|
||||
$builder = new OvertimeContingentExportBuilder($repo, new OvertimePaidContingentCalculator());
|
||||
$builder = new OvertimeContingentExportBuilder($repo, new OvertimePaidContingentCalculator(), new StructuralOvertimeContingentCalculator());
|
||||
$rows = $builder->buildRows([$emp], 2026);
|
||||
|
||||
self::assertCount(1, $rows);
|
||||
@@ -72,4 +77,32 @@ final class OvertimeContingentExportBuilderTest extends TestCase
|
||||
self::assertSame(0, $rows[0]->months[6]);
|
||||
self::assertSame(220, $rows[0]->capHours); // non-driver
|
||||
}
|
||||
|
||||
public function testStructuralHoursOf39hAreAddedToPaidBase(): void
|
||||
{
|
||||
$contract = new Contract()
|
||||
->setName('CDI')
|
||||
->setTrackingMode(TrackingMode::TIME)
|
||||
->setWeeklyHours(39)
|
||||
;
|
||||
$period = new EmployeeContractPeriod()
|
||||
->setContract($contract)
|
||||
->setStartDate(new DateTimeImmutable('2020-01-01'))
|
||||
;
|
||||
$emp = new Employee();
|
||||
$emp->setLastName('Petit')->setFirstName('Marc');
|
||||
$emp->getContractPeriods()->add($period);
|
||||
$idRef = new ReflectionProperty(Employee::class, 'id');
|
||||
$idRef->setValue($emp, 11);
|
||||
|
||||
$repo = $this->createStub(EmployeeRttPaymentRepository::class);
|
||||
$repo->method('findByEmployeesAndYears')->willReturn([]);
|
||||
|
||||
$builder = new OvertimeContingentExportBuilder($repo, new OvertimePaidContingentCalculator(), new StructuralOvertimeContingentCalculator());
|
||||
$rows = $builder->buildRows([$emp], 2026);
|
||||
|
||||
// Aucun paiement RTT, mais 12 × 1040 min de structurel (39h plein sur l'année).
|
||||
self::assertSame(1040, $rows[0]->months[1]);
|
||||
self::assertSame(12 * 1040, $rows[0]->totalMinutes);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user