public function testErrorHandling()
{
$this->client->delete('/_all')->send();
$response = $this->client->post('/_expectation', null, ['matcher' => ''])->send();
$this->assertSame(417, $response->getStatusCode());
$this->assertSame('POST data key "matcher" must be a serialized list of closures', (string) $response->getBody());
$response = $this->client->post('/_expectation', null, ['matcher' => ['foo']])->send();
$this->assertSame(417, $response->getStatusCode());
$this->assertSame('POST data key "matcher" must be a serialized list of closures', (string) $response->getBody());
$response = $this->client->post('/_expectation', null, [])->send();
$this->assertSame(417, $response->getStatusCode());
$this->assertSame('POST data key "response" not found in POST data', (string) $response->getBody());
$response = $this->client->post('/_expectation', null, ['response' => ''])->send();
$this->assertSame(417, $response->getStatusCode());
$this->assertSame('POST data key "response" must be a serialized Symfony response', (string) $response->getBody());
$response = $this->client->post('/_expectation', null, ['response' => serialize(new Response()), 'limiter' => 'foo'])->send();
$this->assertSame(417, $response->getStatusCode());
$this->assertSame('POST data key "limiter" must be a serialized closure', (string) $response->getBody());
}