public function testApiReadResponse_ThrowsException_WhenParserThrowsException()
{
$text = 'Text';
$buffer = new Buffer($text);
$data = 'Data' . HttpReader::HTTP_EOM;
$reader = $this->createReader();
$parser = $this->createParser();
$parser->expects($this->once())->method('parseResponse')->with($text . $data)->will($this->throwException(new Exception()));
$this->setExpectedException(InvalidFormatException::class);
$reader->readResponse($buffer, $data);
}