DeleteUserCest::_before()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
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
use SlayerBirden\DataFlowServer\Domain\Entities\User;
8
9
class DeleteUserCest
10
{
11
    public function _before(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...
12
    {
13
        $I->haveInRepository(User::class, [
14
            'id' => 2,
15
            'first' => 'Tester',
16
            'last' => 'Tester',
17
            'email' => '[email protected]',
18
        ]);
19
    }
20
21
    public function deleteUser(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...
22
    {
23
        $I->wantTo('delete user');
24
        $I->haveHttpHeader('Content-Type', 'application/json');
25
        $I->sendDELETE('/user/2');
26
        $I->seeResponseCodeIs(HttpCode::OK);
27
        $I->seeResponseContainsJson([
28
            'data' => [
29
                'user' => [
30
                    'email' => '[email protected]',
31
                ]
32
            ]
33
        ]);
34
    }
35
36
    public function deleteNonExistingUser(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...
37
    {
38
        $I->wantTo('delete non-existing user');
39
        $I->haveHttpHeader('Content-Type', 'application/json');
40
        $I->sendDELETE('/user/0');
41
        $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
42
        $I->seeResponseContainsJson([
43
            'data' => [
44
                'user' => null
45
            ]
46
        ]);
47
    }
48
}
49