Code Duplication    Length = 24-24 lines in 2 locations

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

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