<?php
|
|
|
|
namespace Tests\Feature\Collaborators\Auth;
|
|
|
|
use App\Collaborator;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Tests\TestCase;
|
|
|
|
class LogoutTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
/** @test */
|
|
public function an_authenticated_collaborator_can_log_out()
|
|
{
|
|
$collaborator = factory(Collaborator::class)->create();
|
|
$this->be($collaborator, 'collaborators');
|
|
|
|
$this->post(route('collaborators.logout'))
|
|
->assertRedirect(route('collaborators.dashboard'));
|
|
|
|
$this->assertFalse(Auth::check('collaborators'));
|
|
}
|
|
|
|
/** @test */
|
|
public function an_unauthenticated_collaborator_can_not_log_out()
|
|
{
|
|
$this->post(route('collaborators.logout'))
|
|
->assertRedirect(route('collaborators.login'));
|
|
|
|
$this->assertFalse(Auth::check('collaborators'));
|
|
}
|
|
}
|