Completed
Push — master ( 3eb757...3bc7c8 )
by Oleg
03:46
created

GetUserCest::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

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