/** * @param Response $response * @param $code * * @return Response */ private function set_simple_error(Response $response, $code) { $error_message = Util::http_code($code); $response->getBody()->write("<span style='color:maroon'><b>{$code} Error</b></span> - <i>{$error_message}.</i>"); return $response->withStatus($code); }
public function test06() { ### http_code($key, $default = NULL) $this->assertEquals('404 Not Found', Util::http_code(404)); $this->assertEquals(502, Util::http_code('Bad Gateway')); $this->assertEquals(900, Util::http_code('Purple Rain', 900)); ### file_in_path($name, Array $paths) $this->assertStringEndsWith('readable_jason.json', Util::file_in_path('readable_jason.json', [__DIR__ . '/'])); ### format_for_url($string) $this->assertEquals('the-balls-are-bouncy-eh', Util::str_to_url('The balls are bouncy, eh?')); }