Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 2201-2224 (lines=24) @@
2198
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2199
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser
2200
     */
2201
    public function testUnassignRoleFromUser()
2202
    {
2203
        $repository = $this->getRepository();
2204
        $roleService = $repository->getRoleService();
2205
2206
        /* BEGIN: Use Case */
2207
        $user = $this->createUserVersion1();
2208
2209
        // Load the existing "Member" role
2210
        $role = $roleService->loadRoleByIdentifier('Member');
2211
2212
        // Assign the "Member" role to the newly created user
2213
        $roleService->assignRoleToUser($role, $user);
2214
2215
        // Unassign user from role
2216
        $roleService->unassignRoleFromUser($role, $user);
2217
2218
        // The assignments array will not contain the new role<->user assignment
2219
        $roleAssignments = $roleService->getRoleAssignments($role);
2220
        /* END: Use Case */
2221
2222
        // Members + Editors + Partners
2223
        $this->assertEquals(3, count($roleAssignments));
2224
    }
2225
2226
    /**
2227
     * Test for the unassignRoleFromUser() method.
@@ 2656-2679 (lines=24) @@
2653
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUserGroup()
2654
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup
2655
     */
2656
    public function testUnassignRoleFromUserGroup()
2657
    {
2658
        $repository = $this->getRepository();
2659
        $roleService = $repository->getRoleService();
2660
2661
        /* BEGIN: Use Case */
2662
        $userGroup = $this->createUserGroupVersion1();
2663
2664
        // Load the existing "Member" role
2665
        $role = $roleService->loadRoleByIdentifier('Member');
2666
2667
        // Assign the "Member" role to the newly created user group
2668
        $roleService->assignRoleToUserGroup($role, $userGroup);
2669
2670
        // Unassign group from role
2671
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2672
2673
        // The assignments array will not contain the new role<->group assignment
2674
        $roleAssignments = $roleService->getRoleAssignments($role);
2675
        /* END: Use Case */
2676
2677
        // Members + Editors + Partners
2678
        $this->assertEquals(3, count($roleAssignments));
2679
    }
2680
2681
    /**
2682
     * Test for the unassignRoleFromUserGroup() method.