GetUserCest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUser() 0 14 1
A getNonExistingUser() 0 12 1
1
<?php
2
3
namespace codecept\user;
4
5
use codecept\ApiTester;
6
use Codeception\Util\HttpCode;
7
8
class GetUserCest
9
{
10
    public function getUser(ApiTester $I)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
11
    {
12
        $I->wantTo('get user');
13
        $I->haveHttpHeader('Content-Type', 'application/json');
14
        $I->sendGET('/user/1');
15
        $I->seeResponseCodeIs(HttpCode::OK);
16
        $I->seeResponseContainsJson([
17
            'data' => [
18
                'user' => [
19
                    'email' => '[email protected]',
20
                ]
21
            ]
22
        ]);
23
    }
24
25
    public function getNonExistingUser(ApiTester $I)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
26
    {
27
        $I->wantTo('get non-existing user');
28
        $I->haveHttpHeader('Content-Type', 'application/json');
29
        $I->sendGET('/user/0');
30
        $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
31
        $I->seeResponseContainsJson([
32
            'data' => [
33
                'user' => null
34
            ]
35
        ]);
36
    }
37
}
38