Code Duplication    Length = 23-49 lines in 3 locations

app/Containers/Authorization/UI/API/Tests/Functional/FindPermissionByNameTest.php 1 location

@@ 16-38 (lines=23) @@
13
 *
14
 * @author  Mahmoud Zalt <[email protected]>
15
 */
16
class FindPermissionByNameTest extends TestCase
17
{
18
19
    private $endpoint = '/find-permission';
20
21
    public function testGetPermission_()
22
    {
23
        $admin = $this->getLoggedInTestingAdmin();
24
25
        $data = ['name' => 'manage-roles-permissions'];
26
27
        // send the HTTP request
28
        $response = $this->apiCall($this->endpoint, 'get', $data, true);
29
30
        // assert response status is correct
31
        $this->assertEquals($response->getStatusCode(), '200');
32
33
        $responseObject = $this->getResponseObject($response);
34
35
        $this->assertEquals($data['name'], $responseObject->data->name);
36
    }
37
38
}
39

app/Containers/Authorization/UI/API/Tests/Functional/FindRoleByNameTest.php 1 location

@@ 16-38 (lines=23) @@
13
 *
14
 * @author  Mahmoud Zalt <[email protected]>
15
 */
16
class FindRoleByNameTest extends TestCase
17
{
18
19
    private $endpoint = '/find-role';
20
21
    public function testGetRole_()
22
    {
23
        $admin = $this->getLoggedInTestingAdmin();
24
25
        $data = ['name' => 'admin'];
26
27
        // send the HTTP request
28
        $response = $this->apiCall($this->endpoint, 'get', $data, true);
29
30
        // assert response status is correct
31
        $this->assertEquals($response->getStatusCode(), '200');
32
33
        $responseObject = $this->getResponseObject($response);
34
35
        $this->assertEquals($data['name'], $responseObject->data->name);
36
    }
37
38
}
39

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

@@ 12-60 (lines=49) @@
9
 *
10
 * @author Mahmoud Zalt <[email protected]>
11
 */
12
class RefreshUserTest extends TestCase
13
{
14
15
    private $endpoint = '/users/refresh';
16
17
    public function testRefreshUserById_()
18
    {
19
        // get the logged in user (create one if no one is logged in)
20
        $user = $this->registerAndLoginTestingUser();
21
22
        $data = [
23
            'user_id' => $user->id,
24
        ];
25
26
        // send the HTTP request
27
        $response = $this->apiCall($this->endpoint, 'post', $data);
28
29
        // assert response status is correct
30
        $this->assertEquals($response->getStatusCode(), '200');
31
    }
32
33
    public function testRefreshUserByToken_()
34
    {
35
        // send the HTTP request
36
        $response = $this->apiCall($this->endpoint, 'post', [], true);
37
38
        // assert response status is correct
39
        $this->assertEquals($response->getStatusCode(), '200');
40
    }
41
}
42