Skip to content

Commit

Permalink
Merge pull request #74 from bowphp/5.x-ref-update
Browse files Browse the repository at this point in the history
Fixes error handler and basic unity tests
  • Loading branch information
papac authored May 16, 2023
2 parents 9ad43a2 + a7b54df commit 84ae75b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/Exceptions/ErrorHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ public function handle($exception): mixed

if ($exception instanceof ModelNotFoundException || $exception instanceof HttpException) {
$code = $exception->getStatusCode();
return $this->render('errors.' . $code, [
$source = $this->render('errors.' . $code, [
'code' => 404,
'exception' => $exception
]);

return $source;
}

if ($exception instanceof HttpResponseException) {
Expand Down
7 changes: 7 additions & 0 deletions tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ public function test_show_the_welcome_page()

$response->assertStatus(200)->assertContentType('text/html');
}

public function test_cannot_show_the_not_found_page()
{
$response = $this->get('/not-found-page');

$response->assertStatus(404)->assertContentType('text/html');
}
}

0 comments on commit 84ae75b

Please sign in to comment.