Code Duplication    Length = 16-17 lines in 3 locations

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

@@ 54-69 (lines=16) @@
51
    /**
52
     * @test
53
     */
54
    public function testGetAllAdminsByNonAdmin_()
55
    {
56
        $this->getTestingUserWithoutAccess();
57
58
        // create some fake users
59
        factory(User::class, 2)->create();
60
61
        // send the HTTP request
62
        $response = $this->makeCall();
63
        // assert response status is correct
64
        $response->assertStatus(403);
65
66
        $this->assertResponseContainKeyValue([
67
            'message' => 'This action is unauthorized.',
68
        ]);
69
    }
70
71
}
72

app/Containers/User/UI/API/Tests/Functional/GetAllUsersTest.php 2 locations

@@ 29-45 (lines=17) @@
26
    /**
27
     * @test
28
     */
29
    public function testGetAllUsersByAdmin_()
30
    {
31
        // create some non-admin users who are clients
32
        factory(User::class, 2)->create();
33
34
        // send the HTTP request
35
        $response = $this->makeCall();
36
37
        // assert response status is correct
38
        $response->assertStatus(200);
39
40
        // convert JSON response string to Object
41
        $responseContent = $this->getResponseContentObject();
42
43
        // assert the returned data size is correct
44
        $this->assertCount(4, $responseContent->data);
45
    }
46
47
    /**
48
     * @test
@@ 50-66 (lines=17) @@
47
    /**
48
     * @test
49
     */
50
    public function testGetAllUsersByNonAdmin_()
51
    {
52
        $this->getTestingUserWithoutAccess();
53
54
        // create some fake users
55
        factory(User::class, 2)->create();
56
57
        // send the HTTP request
58
        $response = $this->makeCall();
59
60
        // assert response status is correct
61
        $response->assertStatus(403);
62
63
        $this->assertResponseContainKeyValue([
64
            'message' => 'This action is unauthorized.',
65
        ]);
66
    }
67
68
    /**
69
     * @test