mirror of
https://github.com/Kovah/LinkAce.git
synced 2025-01-18 05:38:40 +01:00
Add controller test for the dashboard
This commit is contained in:
parent
30fa33f2fe
commit
bf3598faea
33
tests/Feature/Controller/App/DashboardControllerTest.php
Normal file
33
tests/Feature/Controller/App/DashboardControllerTest.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DashboardControllerTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
use DatabaseMigrations;
|
||||
|
||||
public function testValidDashboardResponse(): void
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
$this->actingAs($user);
|
||||
|
||||
$response = $this->get('dashboard');
|
||||
|
||||
$response->assertStatus(200)
|
||||
->assertSee('Hello ' . $user->name . '!');
|
||||
}
|
||||
|
||||
public function testLoginRedirectForDashboard(): void
|
||||
{
|
||||
$response = $this->get('dashboard');
|
||||
|
||||
$response->assertStatus(302)
|
||||
->assertRedirect('login');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user