Completed
Push — master ( 048f0c...ea048a )
by Mahmoud
03:46
created

DeleteUserTest::testDeleteExistingUser_()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
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 DeleteUserTest.
10
 *
11
 * @author Mahmoud Zalt <[email protected]>
12
 */
13
class DeleteUserTest extends TestCase
14
{
15
16
    protected $endpoint = 'delete@users/{id}';
17
18
    protected $access = [
19
        'roles'       => '',
20
        'permissions' => 'delete-users',
21
    ];
22
23
    public function testDeleteExistingUser_()
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('202', $response->getStatusCode());
32
33
        // assert the returned message is correct
34
        $this->assertResponseContainKeyValue([
35
            'message' => 'User (' . $user->id . ') Deleted Successfully.',
36
        ], $response);
37
    }
38
39 View Code Duplication
    public function testDeleteAnotherExistingUser_()
0 ignored issues
show
Duplication introduced by
This method 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...
40
    {
41
        // make the call form the user token who has no access
42
        $this->getTestingUserWithoutAccess();
43
44
        $anotherUser = factory(User::class)->create();
45
46
        // send the HTTP request
47
        $response = $this->injectId($anotherUser->id)->makeCall();
48
49
        // assert response status is correct
50
        $this->assertEquals('500', $response->getStatusCode());
51
    }
52
}
53