Completed
Push — master ( 298ac7...0024da )
by Oleg
12:58
created

GetUserCest::_before()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
use Codeception\Util\HttpCode;
4
5
class GetUserCest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
6
{
7
    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...
8
    {
9
        $I->wantTo('get user');
10
        $I->haveHttpHeader('Content-Type', 'application/json');
11
        $I->sendGET('/user/1');
12
        $I->seeResponseCodeIs(HttpCode::OK);
13
        $I->seeResponseContainsJson([
14
            'success' => true,
15
            'data' => [
16
                'user' => [
17
                    'email' => '[email protected]',
18
                ]
19
            ]
20
        ]);
21
    }
22
23
    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...
24
    {
25
        $I->wantTo('get non-existing user');
26
        $I->haveHttpHeader('Content-Type', 'application/json');
27
        $I->sendGET('/user/0');
28
        $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
29
        $I->seeResponseContainsJson([
30
            'success' => false,
31
            'data' => [
32
                'user' => null
33
            ]
34
        ]);
35
    }
36
}
37