Completed
Push — master ( 630401...3eb757 )
by Oleg
02:43
created

GetUserCest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getUser() 0 15 1
1
<?php
2
3
namespace codecept;
4
5
use Codeception\Util\HttpCode;
6
7
class GetUserCest
8
{
9
    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...
10
    {
11
        $I->wantTo('get user');
12
        $I->haveHttpHeader('Content-Type', 'application/json');
13
        $I->sendGET('/user/1');
14
        $I->seeResponseCodeIs(HttpCode::OK);
15
        $I->seeResponseContainsJson([
16
            'success' => true,
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
            'success' => false,
33
            'data' => [
34
                'user' => null
35
            ]
36
        ]);
37
    }
38
}
39