public function testValidationErrorSingleKnownErrorWithDebug()
{
Configure::write('debug', true);
$entity = new Entity();
$entity->errors('title', ['error 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();
$this->assertContains('trace', array_keys($Controller->viewVars['data']));
unset($Controller->viewVars['data']['trace']);
$expected = ['code' => 422, 'url' => $Controller->request->here(), 'errorCount' => 1, 'errors' => ['title' => ['error message']], 'exception' => ['class' => 'Crud\\Error\\Exception\\ValidationException', 'code' => 422, 'message' => 'A validation error occurred'], 'message' => 'A validation error occurred'];
$this->assertEquals($expected, $Controller->viewVars['data']);
}