public function render() { $code = $this->_code($this->error); if ($code == 404) { $this->controller->redirect('/pagina-nao-encontrada'); } return parent::render(); }
/** * Tests the output of rendering a PDOException * * @return void */ public function testPDOException() { $exception = new \PDOException('There was an error in the SQL query'); $exception->queryString = 'SELECT * from poo_query < 5 and :seven'; $exception->params = ['seven' => 7]; $ExceptionRenderer = new ExceptionRenderer($exception); $ExceptionRenderer->controller->response = $this->getMock('Cake\\Network\\Response', ['statusCode', '_sendHeader']); $ExceptionRenderer->controller->response->expects($this->once())->method('statusCode')->with(500); $result = $ExceptionRenderer->render()->body(); $this->assertContains('Database Error', $result); $this->assertContains('There was an error in the SQL query', $result); $this->assertContains(h('SELECT * from poo_query < 5 and :seven'), $result); $this->assertContains("'seven' => (int) 7", $result); }
public function render() { $this->controller->helpers = ['Html' => ['className' => 'Bootstrap.BootstrapHtml', 'useFontAwesome' => true], 'Form' => ['className' => 'Bootstrap.BootstrapForm'], 'Paginator' => ['className' => 'Bootstrap.BootstrapPaginator'], 'Modal' => ['className' => 'Bootstrap.BootstrapModal'], 'AssetCompress.AssetCompress']; return parent::render(); }