GetPermissionHistoryCest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 11 1
A getHistorySuccess() 0 8 1
1
<?php
2
3
namespace codecept\authorization;
4
5
use codecept\ApiTester;
6
use Codeception\Util\HttpCode;
7
use SlayerBirden\DataFlowServer\Authorization\Entities\History;
8
use SlayerBirden\DataFlowServer\Authorization\Service\HistoryManagement;
9
use SlayerBirden\DataFlowServer\Domain\Entities\User;
10
11
class GetPermissionHistoryCest
12
{
13
    /**
14
     * @param ApiTester $I
15
     * @throws \Exception
16
     */
17
    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...
18
    {
19
        $user = $I->grabEntityFromRepository(User::class, ['id' => $I->getCurrentUserId()]);
20
        $I->haveInRepository(History::class, [
21
            'user' => $user,
22
            'owner' => $user,
23
            'resource' => 'awesome_sauce',
24
            'changeAction' => HistoryManagement::ACTION_REMOVE,
25
            'at' => new \DateTime(),
26
        ]);
27
    }
28
29
    public function getHistorySuccess(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...
30
    {
31
        $I->wantTo('Get permission history');
32
        $I->sendGet('/history');
33
        $I->seeResponseCodeIs(HttpCode::OK);
34
        $I->seeResponseIsJson();
35
        $I->seeResponseJsonMatchesJsonPath('$.data.history[*]');
36
    }
37
}
38