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:
parent
ada6cc3dba
commit
ee4529d4b6
@ -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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user