public function test500() { $this->app->route('500', '/500', function () { throw new \Exception('Test Exception for 500'); }); $this->app->demand('header', function ($header) use(&$headers_list) { $headers_list[] = $header; }); $this->app->simulate_request('/500'); var_dump($headers_list); $this->assertNotEmpty($headers_list); $this->assertContains('HTTP/1.1 500 Internal Server Error', $headers_list); }
use Microsite\Template; use Microsite\Tinycode; use Microsite\Renderers\JSONRenderer; use Microsite\Renderers\MarkdownRenderer; use Microsite\DB\Mongo\DB as MongoDB; //include 'src/microsite.phar'; include 'src/stub2.php'; $app = new App(); // Assign a directory in which templates can be found for rendering $app->template_dirs = [__DIR__ . '/views']; /** * Basic home page. * Set the view to a home.php view provided in the view directory */ $app->route('home', '/', function (App $app) { return $app->response()->render('home.php'); }); /** * Simple string output. */ $app->route('string', '/string', function () { return "A response can be a simple string from inside a function"; }); /** * Weird routing issue */ $app->route('inbound', '/inbound', function () { echo 'ok?'; }); /** * Simple echo output.