Completed
Push — master ( 2f13e8...b9cf14 )
by Mahmoud
17:22 queued 17:17
created

UserLogoutTest::testUserLogout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
rs 9.2
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
3
namespace App\Containers\Authentication\UI\WEB\Tests\Functional;
4
5
use App\Ship\Parents\Tests\PhpUnit\TestCase;
6
use App\Ship\Parents\Tests\PhpUnit\WebTestCase;
7
use Illuminate\Foundation\Testing\WithoutMiddleware;
8
9
/**
10
 * Class UserLoginTest
11
 *
12
 * @author  Johan Alvarez <[email protected]>
13
 * @author  Mahmoud Zalt  <[email protected]>
14
 */
15
class UserLogoutTest extends TestCase
16
{
17
    use WithoutMiddleware;
18
19
    // overrides the default subDomain in the base URL
20
    protected $subDomain = 'admin';
21
    protected $endpoint = '/logout';
22
23
    public function testUserLogout()
24
    {
25
        // go to the page
26
        $this->visit('login')
27
            ->see('Login');
28
29
        // fill the login form
30
        $this->type('[email protected]', 'email')
31
            ->type('admin', 'password')
32
            ->press('login');
33
34
        // login success and redirect to welcome view
35
        $this->seePageIs('/dashboard')
36
            ->see('Hello Admin');
37
38
        // trigger the logout request
39
        $response = $this->post($this->endpoint);
40
41
        $response->assertResponseStatus(302);
42
        $this->assertRedirectedTo('login');
43
        $this->see('login');
44
    }
45
}
46