Completed
Push — master ( 0ca83f...63d559 )
by Mahmoud
05:04
created

UserLogoutTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 27
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testWebUserLogout() 0 22 1
1
<?php
2
3
namespace App\Containers\Authentication\UI\WEB\Tests\Functional;
4
5
use App\Containers\Authentication\Tests\WebTestCase;
6
7
/**
8
 * Class UserLoginTest
9
 *
10
 * @author  Johan Alvarez <[email protected]>
11
 * @author  Mahmoud Zalt  <[email protected]>
12
 */
13
class UserLogoutTest extends WebTestCase
14
{
15
    protected $endpoint = '/logout';
16
17
    public function testWebUserLogout()
18
    {
19
        // go to the page
20
        $this->visit('login')
21
            ->see('Login');
22
23
        // fill the login form
24
        $this->type('[email protected]', 'email')
25
            ->type('admin', 'password')
26
            ->press('login');
27
28
        // login success and redirect to welcome view
29
        $this->seePageIs('/dashboard')
30
            ->see('Hello Admin');
31
32
        // trigger the logout request
33
        $response = $this->post($this->endpoint);
34
35
        $response->assertResponseStatus(302);
36
        $this->assertRedirectedTo('login');
37
        $this->see('login');
38
    }
39
}
40