FindRoleTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFindRoleById_() 14 14 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace App\Containers\Authorization\UI\API\Tests\Functional;
4
5
use App\Containers\Authorization\Models\Role;
6
use App\Containers\Authorization\Tests\ApiTestCase;
7
8
/**
9
 * Class FindRoleTest.
10
 *
11
 * @group authorization
12
 * @group api
13
 *
14
 * @author  Mahmoud Zalt <[email protected]>
15
 */
16 View Code Duplication
class FindRoleTest extends ApiTestCase
0 ignored issues
show
Duplication introduced by Mahmoud Zalt
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
19
    protected $endpoint = '[email protected]/roles/{id}';
20
21
    protected $access = [
22
        'roles'       => '',
23
        'permissions' => 'manage-roles',
24
    ];
25
26
    /**
27
     * @test
28
     */
29
    public function testFindRoleById_()
30
    {
31
        $roleA = factory(Role::class)->create();
32
33
        // send the HTTP request
34
        $response = $this->injectId($roleA->id)->makeCall();
35
36
        // assert response status is correct
37
        $response->assertStatus(200);
38
39
        $responseContent = $this->getResponseContentObject();
40
41
        $this->assertEquals($roleA->name, $responseContent->data->name);
42
    }
43
44
}
45