1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-24 01:53:58 +01:00

add test for invalid json response

This commit is contained in:
Gordon Franke 2012-04-25 08:51:23 +02:00
parent ada6cc3dba
commit ee4529d4b6

View File

@ -158,6 +158,24 @@ class CommandTest extends AbstractCommandTest
), $command->getResult());
}
/**
* @covers Guzzle\Service\Command\AbstractCommand::process
* @expectedException Guzzle\Service\Exception\JsonException
*/
public function testConvertsInvalidJsonResponsesToArray()
{
$client = $this->getClient();
$client->getEventDispatcher()->addSubscriber(new MockPlugin(array(
new \Guzzle\Http\Message\Response(200, array(
'Content-Type' => 'application/json'
), '{ "key": "Hi!" }invalid'
)
)));
$command = new MockCommand();
$command->setClient($client);
$command->execute();
}
/**
* @covers Guzzle\Service\Command\AbstractCommand::process
*/