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

testLoginWithInvalidCredentials()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 14
rs 10
c 0
b 0
f 0
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