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()); } }