Code Duplication    Length = 24-24 lines in 2 locations

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

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