AuthLoginTest::testLogin()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests\integration;
6
7
class AuthLoginTest extends BaseTestCase
8
{
9
    /**
10
     * Test user login endpoint and get a JWT Bearer Authorization.
11
     */
12
    public function testLogin(): void
13
    {
14
        $response = $this->runApp('POST', '/login', ['email' => '[email protected]', 'password' => 'AnyPass1000']);
15
16
        $result = (string) $response->getBody();
17
18
        self::$jwt = json_decode($result)->message->Authorization;
19
20
        $this->assertEquals(200, $response->getStatusCode());
21
        $this->assertEquals('application/json', $response->getHeaderLine('Content-Type'));
22
        $this->assertStringContainsString('Authorization', $result);
23
        $this->assertStringContainsString('Bearer', $result);
24
    }
25
}
26