Skip to content

Commit e500265

Browse files
committed
Fix tests
1 parent f903bea commit e500265

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

.env.testing

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ APP_DEBUG=true
1616
APP_BASEDIR=""
1717
APP_TIMEZONE=null
1818

19+
# URL for testing
20+
APP_URL="http://localhost:8000"
21+
1922
# Session
2023
SESSION_ENABLE=true
2124
SESSION_DURATION=0

app/tests/IndexTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,24 @@ protected function setUp(): void
2424
*/
2525
public function testIndex()
2626
{
27-
$response = $this->request(Asatru\Testing\Test::REQUEST_GET, '/auth')->getResponse();
27+
$response = $this->request(Asatru\Testing\Test::REQUEST_GET, '/')->getResponse();
28+
29+
$this->assertInstanceOf(Asatru\View\ViewHandler::class, $response);
30+
$this->assertStringContainsString('<h1>' . __('app.welcome') . '</h1>', $response->out(true));
31+
}
32+
33+
/**
34+
* @return void
35+
*/
36+
public function testError404()
37+
{
38+
$checkUrl = '/does/not/exist';
39+
40+
$response = $this->request(Asatru\Testing\Test::REQUEST_GET, $checkUrl)->getResponse();
41+
2842
$this->assertInstanceOf(Asatru\View\ViewHandler::class, $response);
43+
$this->assertStringContainsString('<h1>Error 404</h1>', $response->out(true));
44+
$this->assertStringContainsString('<p>The requested resource ' . env('APP_URL') . $checkUrl . ' was not found on the server.</p>', $response->out(true));
2945
}
3046
}
3147

0 commit comments

Comments
 (0)