Completed
Push — master ( 3eb757...3bc7c8 )
by Oleg
03:46
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
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUser() 0 15 1
A getNonExistingUser() 0 13 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
            'success' => true,
18
            'data' => [
19
                'user' => [
20
                    'email' => '[email protected]',
21
                ]
22
            ]
23
        ]);
24
    }
25
26
    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...
27
    {
28
        $I->wantTo('get non-existing user');
29
        $I->haveHttpHeader('Content-Type', 'application/json');
30
        $I->sendGET('/user/0');
31
        $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
32
        $I->seeResponseContainsJson([
33
            'success' => false,
34
            'data' => [
35
                'user' => null
36
            ]
37
        ]);
38
    }
39
}
40