Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbrendel committed Jul 20, 2024
1 parent f903bea commit e500265
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ APP_DEBUG=true
APP_BASEDIR=""
APP_TIMEZONE=null

# URL for testing
APP_URL="http://localhost:8000"

# Session
SESSION_ENABLE=true
SESSION_DURATION=0
Expand Down
18 changes: 17 additions & 1 deletion app/tests/IndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,24 @@ protected function setUp(): void
*/
public function testIndex()
{
$response = $this->request(Asatru\Testing\Test::REQUEST_GET, '/auth')->getResponse();
$response = $this->request(Asatru\Testing\Test::REQUEST_GET, '/')->getResponse();

$this->assertInstanceOf(Asatru\View\ViewHandler::class, $response);
$this->assertStringContainsString('<h1>' . __('app.welcome') . '</h1>', $response->out(true));
}

/**
* @return void
*/
public function testError404()
{
$checkUrl = '/does/not/exist';

$response = $this->request(Asatru\Testing\Test::REQUEST_GET, $checkUrl)->getResponse();

$this->assertInstanceOf(Asatru\View\ViewHandler::class, $response);
$this->assertStringContainsString('<h1>Error 404</h1>', $response->out(true));
$this->assertStringContainsString('<p>The requested resource ' . env('APP_URL') . $checkUrl . ' was not found on the server.</p>', $response->out(true));
}
}

0 comments on commit e500265

Please sign in to comment.