public function testValidationErrorMultipleMessages()
{
$entity = new Entity();
$entity->errors(['title' => ['error message'], 'body' => ['another field message']]);
$Exception = new ValidationException($entity);
$Controller = $this->getMockBuilder('Cake\\Controller\\Controller')->setMethods(['render'])->getMock();
$Controller->request = new Request();
$Controller->response = new Response();
$Renderer = $this->getMockBuilder('Crud\\Error\\ExceptionRenderer')->setMethods(['_getController'])->disableOriginalConstructor()->getMock();
$Renderer->expects($this->once())->method('_getController')->with()->will($this->returnValue($Controller));
$Renderer->__construct($Exception);
$Renderer->render();
$expected = ['code' => 422, 'url' => $Controller->request->here(), 'message' => '2 validation errors occurred', 'errorCount' => 2, 'errors' => ['title' => ['error message'], 'body' => ['another field message']], 'exception' => ['class' => 'Crud\\Error\\Exception\\ValidationException', 'code' => 422, 'message' => '2 validation errors occurred']];
$data = $Controller->viewVars['data'];
unset($data['trace']);
$this->assertEquals($expected, $data);
}