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

DeleteUserCest::_before()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
rs 9.9666
cc 1
nc 1
nop 1
1
<?php
2
3
namespace codecept;
4
5
use Codeception\Util\HttpCode;
6
use SlayerBirden\DataFlowServer\Domain\Entities\User;
7
8
class DeleteUserCest
9
{
10
    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...
11
    {
12
        $I->haveInRepository(User::class, [
13
            'id' => 2,
14
            'first' => 'Tester',
15
            'last' => 'Tester',
16
            'email' => '[email protected]',
17
        ]);
18
    }
19
20
    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...
21
    {
22
        $I->wantTo('delete user');
23
        $I->haveHttpHeader('Content-Type', 'application/json');
24
        $I->sendDELETE('/user/2');
25
        $I->seeResponseCodeIs(HttpCode::OK);
26
        $I->seeResponseContainsJson([
27
            'success' => true,
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
            'success' => false,
44
            'data' => [
45
                'user' => null
46
            ]
47
        ]);
48
    }
49
}
50