feat: mention selected port by api client in log messages
This commit is contained in:
@@ -18,14 +18,17 @@ use Symfony\Component\Serializer\SerializerInterface;
|
||||
class ApiClientReceiveTest extends TestCase
|
||||
{
|
||||
private ApiClient $apiClient;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->apiClient = new ApiClient(
|
||||
$this->createMock(SerializerInterface::class),
|
||||
$this->createMock(ApiResponseParser::class),
|
||||
$this->createMock(FilesystemOperator::class),
|
||||
$this->createMock(LoggerInterface::class),
|
||||
$this->logger,
|
||||
$this->createMock(BookingDataProcessor::class),
|
||||
new RequestStack(),
|
||||
new RequestIdGenerator(),
|
||||
@@ -45,6 +48,16 @@ class ApiClientReceiveTest extends TestCase
|
||||
rewind($stream);
|
||||
|
||||
$this->setOperationStartTime();
|
||||
$this->setSelectedPort(9000);
|
||||
|
||||
$this->logger->expects($this->once())
|
||||
->method('warning')
|
||||
->with(
|
||||
'Server closed connection without sending data',
|
||||
$this->callback(static function (array $context): bool {
|
||||
return 9000 === $context['port'];
|
||||
}),
|
||||
);
|
||||
|
||||
$this->expectException(ImmediateConnectionCloseException::class);
|
||||
$this->expectExceptionMessage('Server closed connection without sending data');
|
||||
@@ -77,4 +90,10 @@ class ApiClientReceiveTest extends TestCase
|
||||
$property = new \ReflectionProperty(ApiClient::class, 'operationStartTime');
|
||||
$property->setValue($this->apiClient, microtime(true));
|
||||
}
|
||||
|
||||
private function setSelectedPort(int $port): void
|
||||
{
|
||||
$property = new \ReflectionProperty(ApiClient::class, 'selectedPort');
|
||||
$property->setValue($this->apiClient, $port);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user