feat: ajout des 3 derniers WS en lecture du bundle malio ednotif (!47)
All checks were successful
Auto Tag Develop / tag (push) Successful in 6s
All checks were successful
Auto Tag Develop / tag (push) Successful in 6s
- 3 nouveaux endpoints API Platform pass-through sur /api/bovins/{inventory|returned-dossiers|presumed-exits} consommant BovinApiInterface v0.0.6
- AnimalSummaryMapper (src/Service/) factorisant le mapping DTO EDNOTIF -> ressource
- src/State/ réorganisé par domaine (Bovin/, Reception/, Shipment/, Building/, User/, System/)
- tag OpenAPI "Bovins" pour regrouper les endpoints ednotif dans Swagger
- malio/ednotif-bundle passé à v0.0.6
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| 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: #47
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #47.
This commit is contained in:
62
tests/State/Reception/ReceptionWeighingProviderTest.php
Normal file
62
tests/State/Reception/ReceptionWeighingProviderTest.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\State\Reception;
|
||||
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\Dto\PontBasculeReading;
|
||||
use App\Service\PontBasculePayloadDecoder;
|
||||
use App\Service\PontBasculeService;
|
||||
use App\State\Reception\ReceptionWeighingProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class ReceptionWeighingProviderTest extends TestCase
|
||||
{
|
||||
public function testProvideReturnsReading(): void
|
||||
{
|
||||
$decoder = new PontBasculePayloadDecoder();
|
||||
|
||||
$httpClient = $this->createMock(HttpClientInterface::class);
|
||||
$httpClient->expects(self::never())->method('request');
|
||||
|
||||
$service = new PontBasculeService($httpClient, $decoder, 'http://example.test', true);
|
||||
|
||||
$provider = new ReceptionWeighingProvider($service);
|
||||
|
||||
$result = $provider->provide(new Get());
|
||||
|
||||
self::assertInstanceOf(PontBasculeReading::class, $result);
|
||||
self::assertSame(121, $result->getDsd());
|
||||
self::assertSame(1420.0, $result->getWeight());
|
||||
}
|
||||
|
||||
public function testProvideThrowsHttpException(): void
|
||||
{
|
||||
$exception = $this->createStub(TransportExceptionInterface::class);
|
||||
|
||||
$httpClient = $this->createMock(HttpClientInterface::class);
|
||||
$httpClient
|
||||
->expects(self::once())
|
||||
->method('request')
|
||||
->willThrowException($exception)
|
||||
;
|
||||
|
||||
$decoder = new PontBasculePayloadDecoder();
|
||||
|
||||
$service = new PontBasculeService($httpClient, $decoder, 'http://example.test', false);
|
||||
|
||||
$provider = new ReceptionWeighingProvider($service);
|
||||
|
||||
$this->expectException(HttpException::class);
|
||||
$this->expectExceptionMessage('Erreur lors de la communication avec le pont bascule:');
|
||||
|
||||
$provider->provide(new Get());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user