feat: ajout des notifications d'entrées/sorties (#5)
All checks were successful
Auto Tag Develop / tag (push) Successful in 6s
Build Release Artefact / build (push) Successful in 38s

| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|                  |                 |

## Description de la PR

## Modification du .env

## Check list

- [ ] Pas de régression
- [ ] TU/TI/TF rédigée
- [ ] TU/TI/TF OK
- [ ] CHANGELOG modifié

Reviewed-on: #5
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #5.
This commit is contained in:
2026-04-22 13:28:23 +00:00
committed by Autin
parent a60a6e46de
commit 8e8f955ff3
16 changed files with 1916 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
namespace Malio\EdnotifBundle\Tests\Unit\Bovin\Mapper;
use DateTimeImmutable;
use Malio\EdnotifBundle\Bovin\Dto\CreateEntreeResponseDto;
use Malio\EdnotifBundle\Bovin\Mapper\CreateEntreeResponseMapper;
use Malio\EdnotifBundle\Shared\Mapper\StandardResponseMapper;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use stdClass;
/**
* @internal
*/
#[CoversClass(CreateEntreeResponseMapper::class)]
final class CreateEntreeResponseMapperTest extends TestCase
{
public function testMapPendingBdniValidation(): void
{
$soapResponse = new stdClass();
$soapResponse->ReponseStandard = new stdClass();
$soapResponse->ReponseStandard->Resultat = true;
$soapResponse->ReponseSpecifique = new stdClass();
$soapResponse->ReponseSpecifique->AttenteValidationBDNi = true;
$dto = new CreateEntreeResponseMapper(new StandardResponseMapper())->map($soapResponse);
self::assertInstanceOf(CreateEntreeResponseDto::class, $dto);
self::assertTrue($dto->standardResponse->result);
self::assertTrue($dto->pendingBdniValidation);
self::assertNull($dto->identification);
self::assertNull($dto->entryMovement);
}
public function testMapValidatedEntry(): void
{
$soapResponse = new stdClass();
$soapResponse->ReponseStandard = new stdClass();
$soapResponse->ReponseStandard->Resultat = true;
$soapResponse->ReponseSpecifique = new stdClass();
$validee = new stdClass();
$validee->IdentiteBovin = new stdClass();
$validee->IdentiteBovin->Sexe = 'F';
$validee->IdentiteBovin->Bovin = new stdClass();
$validee->IdentiteBovin->Bovin->CodePays = 'FR';
$validee->IdentiteBovin->Bovin->NumeroNational = 'FR1234567890';
$validee->MouvementEntreeBovin = new stdClass();
$validee->MouvementEntreeBovin->DateEntree = '2026-04-22';
$validee->MouvementEntreeBovin->CauseEntree = 'A';
$soapResponse->ReponseSpecifique->EntreeValidee = $validee;
$dto = new CreateEntreeResponseMapper(new StandardResponseMapper())->map($soapResponse);
self::assertFalse($dto->pendingBdniValidation);
self::assertNotNull($dto->identification);
self::assertSame('F', $dto->identification->sex);
self::assertSame('FR1234567890', $dto->identification->bovin?->nationalNumber);
self::assertNotNull($dto->entryMovement);
self::assertEquals(new DateTimeImmutable('2026-04-22'), $dto->entryMovement->date);
self::assertSame('A', $dto->entryMovement->cause);
}
}

View File

@@ -0,0 +1,77 @@
<?php
declare(strict_types=1);
namespace Malio\EdnotifBundle\Tests\Unit\Bovin\Mapper;
use DateTimeImmutable;
use Malio\EdnotifBundle\Bovin\Dto\CreateSortieResponseDto;
use Malio\EdnotifBundle\Bovin\Mapper\CreateSortieResponseMapper;
use Malio\EdnotifBundle\Shared\Mapper\StandardResponseMapper;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use stdClass;
/**
* @internal
*/
#[CoversClass(CreateSortieResponseMapper::class)]
final class CreateSortieResponseMapperTest extends TestCase
{
public function testMapPendingBdniValidation(): void
{
$soapResponse = new stdClass();
$soapResponse->ReponseStandard = new stdClass();
$soapResponse->ReponseStandard->Resultat = true;
$soapResponse->ReponseSpecifique = new stdClass();
$soapResponse->ReponseSpecifique->AttenteValidationBDNi = true;
$dto = new CreateSortieResponseMapper(new StandardResponseMapper())->map($soapResponse);
self::assertInstanceOf(CreateSortieResponseDto::class, $dto);
self::assertTrue($dto->pendingBdniValidation);
self::assertNull($dto->identification);
self::assertNull($dto->entryMovement);
self::assertNull($dto->exitMovement);
}
public function testMapValidatedExit(): void
{
$soapResponse = new stdClass();
$soapResponse->ReponseStandard = new stdClass();
$soapResponse->ReponseStandard->Resultat = true;
$soapResponse->ReponseSpecifique = new stdClass();
$validee = new stdClass();
$validee->IdentiteBovin = new stdClass();
$validee->IdentiteBovin->Sexe = 'M';
$validee->IdentiteBovin->Bovin = new stdClass();
$validee->IdentiteBovin->Bovin->NumeroNational = 'FR9999999999';
$mouvement = new stdClass();
$mouvement->MouvementEntreeBovin = new stdClass();
$mouvement->MouvementEntreeBovin->DateEntree = '2024-01-10';
$mouvement->MouvementEntreeBovin->CauseEntree = 'A';
$mouvement->MouvementSortieBovin = new stdClass();
$mouvement->MouvementSortieBovin->DateSortie = '2026-04-22';
$mouvement->MouvementSortieBovin->CauseSortie = 'B';
$validee->MouvementBovin = $mouvement;
$soapResponse->ReponseSpecifique->SortieValidee = $validee;
$dto = new CreateSortieResponseMapper(new StandardResponseMapper())->map($soapResponse);
self::assertFalse($dto->pendingBdniValidation);
self::assertNotNull($dto->identification);
self::assertSame('M', $dto->identification->sex);
self::assertSame('FR9999999999', $dto->identification->bovin?->nationalNumber);
self::assertNotNull($dto->entryMovement);
self::assertEquals(new DateTimeImmutable('2024-01-10'), $dto->entryMovement->date);
self::assertSame('A', $dto->entryMovement->cause);
self::assertNotNull($dto->exitMovement);
self::assertEquals(new DateTimeImmutable('2026-04-22'), $dto->exitMovement->date);
self::assertSame('B', $dto->exitMovement->cause);
}
}