Code Duplication    Length = 17-19 lines in 2 locations

app/Containers/User/UI/API/Tests/Functional/DeleteUserTest.php 1 location

@@ 17-33 (lines=17) @@
14
15
    private $endpoint = '/users';
16
17
    public function testDeleteExistingUser_()
18
    {
19
        $user = $this->getLoggedInTestingUser();
20
21
        $endpoint = $this->endpoint . '/' . $user->id;
22
23
        // send the HTTP request
24
        $response = $this->apiCall($endpoint, 'delete');
25
26
        // assert response status is correct
27
        $this->assertEquals($response->getStatusCode(), '202');
28
29
        // assert the returned message is correct
30
        $this->assertResponseContainKeyValue([
31
            'message' => 'User (' . $user->id . ') Deleted Successfully.',
32
        ], $response);
33
    }
34
35
    // TODO: after upgrading to Laravel 5.2 this function started returning 500 instead of 403
36
    // it could be due to something in `app/Port/Exception/Handler/ExceptionsHandler.php` and the don't report thingy

app/Containers/User/UI/API/Tests/Functional/UpdateUserTest.php 1 location

@@ 44-62 (lines=19) @@
41
        $this->seeInDatabase('users', ['name' => $data['name']]);
42
    }
43
44
    public function testUpdateExistingUserWithEmptyValues()
45
    {
46
        $user = $this->getLoggedInTestingUser();
47
48
        $data = []; // empty data
49
50
        $endpoint = $this->endpoint . '/' . $user->id;
51
52
        // send the HTTP request
53
        $response = $this->apiCall($endpoint, 'put', $data);
54
55
        // assert response status is correct
56
        $this->assertEquals($response->getStatusCode(), '417');
57
58
        // assert message is correct
59
        $this->assertResponseContainKeyValue([
60
            'message' => 'All inputs are empty.',
61
        ], $response);
62
    }
63
64
    // TODO: after upgrading to Laravel 5.2 this function started returning 500 instead of 403
65
    // it could be due to something in `app/Port/Exception/Handler/ExceptionsHandler.php` and the don't report thingy