Completed
Push — master ( 48d32a...4da889 )
by Igor
04:45
created

AuthControllerInvalidTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testLoginWithInvalidCredentials() 0 14 1
1
<?php
2
3
namespace Tests\Feature;
4
5
use Tests\TestCase;
6
use Illuminate\Foundation\Testing\DatabaseMigrations;
7
8
class AuthControllerInvalidTest extends TestCase
9
{
10
    use DatabaseMigrations;
11
12
    public function testLoginWithInvalidCredentials()
13
    {
14
        //When we try to login passing wrong credentials
15
        $payload = [
16
            'login' => 'foo',
17
            'password' => 'bar',
18
        ];
19
20
        $response = $this->json('POST', 'api/v1/backoffice/login', $payload);
21
22
        // It should return an error invalid_credentials
23
        $response
24
            ->assertStatus(401)
25
            ->assertJson(['error' => 'invalid_credentials']);
26
    }
27
}
28