logger = $this->createMock(LoggerInterface::class); $this->connectionPool = $this->createMock(AbstractConnectionPool::class); $this->connection = $this->createMock(Connection::class); } public function testPerformRequestWithServerErrorResponseException404Result() { $deferred = new Deferred(); $deferred->reject(new ServerErrorResponseException('foo', 404)); $future = new FutureArray($deferred->promise()); $this->connection->method('performRequest') ->willReturn($future); $this->connectionPool->method('nextConnection') ->willReturn($this->connection); $this->connectionPool->expects($this->never()) ->method('scheduleCheck'); $transport = new Transport(1, $this->connectionPool, $this->logger); $result = $transport->performRequest('GET', '/'); $this->assertInstanceOf(FutureArrayInterface::class, $result); } public function testPerformRequestWithServerErrorResponseException500Result() { $deferred = new Deferred(); $deferred->reject(new ServerErrorResponseException('foo', 500)); $future = new FutureArray($deferred->promise()); $this->connection->method('performRequest') ->willReturn($future); $this->connectionPool->method('nextConnection') ->willReturn($this->connection); $this->connectionPool->expects($this->once()) ->method('scheduleCheck'); $transport = new Transport(1, $this->connectionPool, $this->logger); $result = $transport->performRequest('GET', '/'); $this->assertInstanceOf(FutureArrayInterface::class, $result); } }