Code Duplication    Length = 24-24 lines in 2 locations

eZ/Publish/API/Repository/Tests/RoleServiceTest.php 2 locations

@@ 2175-2198 (lines=24) @@
2172
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2173
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser
2174
     */
2175
    public function testUnassignRoleFromUser()
2176
    {
2177
        $repository = $this->getRepository();
2178
        $roleService = $repository->getRoleService();
2179
2180
        /* BEGIN: Use Case */
2181
        $user = $this->createUserVersion1();
2182
2183
        // Load the existing "Member" role
2184
        $role = $roleService->loadRoleByIdentifier('Member');
2185
2186
        // Assign the "Member" role to the newly created user
2187
        $roleService->assignRoleToUser($role, $user);
2188
2189
        // Unassign user from role
2190
        $roleService->unassignRoleFromUser($role, $user);
2191
2192
        // The assignments array will not contain the new role<->user assignment
2193
        $roleAssignments = $roleService->getRoleAssignments($role);
2194
        /* END: Use Case */
2195
2196
        // Members + Editors + Partners
2197
        $this->assertEquals(3, count($roleAssignments));
2198
    }
2199
2200
    /**
2201
     * Test for the unassignRoleFromUser() method.
@@ 2595-2618 (lines=24) @@
2592
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUserGroup()
2593
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup
2594
     */
2595
    public function testUnassignRoleFromUserGroup()
2596
    {
2597
        $repository = $this->getRepository();
2598
        $roleService = $repository->getRoleService();
2599
2600
        /* BEGIN: Use Case */
2601
        $userGroup = $this->createUserGroupVersion1();
2602
2603
        // Load the existing "Member" role
2604
        $role = $roleService->loadRoleByIdentifier('Member');
2605
2606
        // Assign the "Member" role to the newly created user group
2607
        $roleService->assignRoleToUserGroup($role, $userGroup);
2608
2609
        // Unassign group from role
2610
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2611
2612
        // The assignments array will not contain the new role<->group assignment
2613
        $roleAssignments = $roleService->getRoleAssignments($role);
2614
        /* END: Use Case */
2615
2616
        // Members + Editors + Partners
2617
        $this->assertEquals(3, count($roleAssignments));
2618
    }
2619
2620
    /**
2621
     * Test for the unassignRoleFromUserGroup() method.