1
0
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:
Kovah 2020-01-29 12:18:40 +01:00
parent 30fa33f2fe
commit bf3598faea
No known key found for this signature in database
GPG Key ID: AAAA031BA9830D7B

View 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');
}
}