Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 2102-2125 (lines=24) @@
2099
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2100
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser
2101
     */
2102
    public function testUnassignRoleFromUser()
2103
    {
2104
        $repository = $this->getRepository();
2105
        $roleService = $repository->getRoleService();
2106
2107
        /* BEGIN: Use Case */
2108
        $user = $this->createUserVersion1();
2109
2110
        // Load the existing "Member" role
2111
        $role = $roleService->loadRoleByIdentifier('Member');
2112
2113
        // Assign the "Member" role to the newly created user
2114
        $roleService->assignRoleToUser($role, $user);
2115
2116
        // Unassign user from role
2117
        $roleService->unassignRoleFromUser($role, $user);
2118
2119
        // The assignments array will not contain the new role<->user assignment
2120
        $roleAssignments = $roleService->getRoleAssignments($role);
2121
        /* END: Use Case */
2122
2123
        // Members + Editors + Partners
2124
        $this->assertEquals(3, count($roleAssignments));
2125
    }
2126
2127
    /**
2128
     * Test for the unassignRoleFromUser() method.
@@ 2522-2545 (lines=24) @@
2519
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUserGroup()
2520
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup
2521
     */
2522
    public function testUnassignRoleFromUserGroup()
2523
    {
2524
        $repository = $this->getRepository();
2525
        $roleService = $repository->getRoleService();
2526
2527
        /* BEGIN: Use Case */
2528
        $userGroup = $this->createUserGroupVersion1();
2529
2530
        // Load the existing "Member" role
2531
        $role = $roleService->loadRoleByIdentifier('Member');
2532
2533
        // Assign the "Member" role to the newly created user group
2534
        $roleService->assignRoleToUserGroup($role, $userGroup);
2535
2536
        // Unassign group from role
2537
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2538
2539
        // The assignments array will not contain the new role<->group assignment
2540
        $roleAssignments = $roleService->getRoleAssignments($role);
2541
        /* END: Use Case */
2542
2543
        // Members + Editors + Partners
2544
        $this->assertEquals(3, count($roleAssignments));
2545
    }
2546
2547
    /**
2548
     * Test for the unassignRoleFromUserGroup() method.