public function testConstruct() { $response = new Html5Responder('<p>foo:bar</p>'); $response->getHtmlLayout()->setTitle('Test'); $response->disableSendHeaders(); ob_start(); $response->send(); $output = ob_get_contents(); ob_end_clean(); $this->assertContains('<body>', $output); $this->assertContains('<p>foo:bar</p>', $output); $this->assertContains('<title>Test</title>', $output); }
/** * @param \Exception $exception * @return \Huruk\Dispatcher\Responder */ protected static function handleException(\Exception $exception) { $response = new Html5Responder('<h1>Not found</h1><code>' . $exception->getMessage() . '</code>', 500); $response->getHtmlLayout()->setTitle('Huruk µFramework - Error')->setApplicationName('Huruk µFramework')->setCharset(Charset::CHARSET_UTF8); return $response; }