Completed
Push — master ( d7caaf...048f0c )
by Mahmoud
04:10
created

RefreshUserTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testRefreshUserById_() 0 10 1
A testRefreshAnotherUserById_() 0 11 1
1
<?php
2
3
namespace App\Containers\User\UI\API\Tests\Functional;
4
5
use App\Containers\User\Models\User;
6
use App\Containers\User\Tests\TestCase;
7
8
/**
9
 * Class RefreshUserTest.
10
 *
11
 * @author Mahmoud Zalt <[email protected]>
12
 */
13
class RefreshUserTest extends TestCase
14
{
15
16
    protected $endpoint = 'post@users/{id}/refresh';
17
18
    protected $access = [
19
        'roles'       => '',
20
        'permissions' => '',
21
    ];
22
23
    public function testRefreshUserById_()
24
    {
25
        $user = $this->getTestingUser();
26
27
        // send the HTTP request
28
        $response = $this->injectId($user->id)->makeCall();
29
30
        // assert response status is correct
31
        $this->assertEquals('200', $response->getStatusCode());
32
    }
33
34
    public function testRefreshAnotherUserById_()
35
    {
36
        $user = $this->getTestingUser();
0 ignored issues
show
Unused Code introduced by
$user is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
37
38
        $anotherUser = factory(User::class)->create();
39
        // send the HTTP request
40
        $response = $this->injectId($anotherUser->id)->makeCall();
41
42
        // assert response status is correct
43
        $this->assertEquals('500', $response->getStatusCode());
44
    }
45
46
}
47