Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 2133-2156 (lines=24) @@
2130
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2131
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser
2132
     */
2133
    public function testUnassignRoleFromUser()
2134
    {
2135
        $repository = $this->getRepository();
2136
        $roleService = $repository->getRoleService();
2137
2138
        /* BEGIN: Use Case */
2139
        $user = $this->createUserVersion1();
2140
2141
        // Load the existing "Member" role
2142
        $role = $roleService->loadRoleByIdentifier('Member');
2143
2144
        // Assign the "Member" role to the newly created user
2145
        $roleService->assignRoleToUser($role, $user);
2146
2147
        // Unassign user from role
2148
        $roleService->unassignRoleFromUser($role, $user);
2149
2150
        // The assignments array will not contain the new role<->user assignment
2151
        $roleAssignments = $roleService->getRoleAssignments($role);
2152
        /* END: Use Case */
2153
2154
        // Members + Editors + Partners
2155
        $this->assertEquals(3, count($roleAssignments));
2156
    }
2157
2158
    /**
2159
     * Test for the unassignRoleFromUser() method.
@@ 2553-2576 (lines=24) @@
2550
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUserGroup()
2551
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup
2552
     */
2553
    public function testUnassignRoleFromUserGroup()
2554
    {
2555
        $repository = $this->getRepository();
2556
        $roleService = $repository->getRoleService();
2557
2558
        /* BEGIN: Use Case */
2559
        $userGroup = $this->createUserGroupVersion1();
2560
2561
        // Load the existing "Member" role
2562
        $role = $roleService->loadRoleByIdentifier('Member');
2563
2564
        // Assign the "Member" role to the newly created user group
2565
        $roleService->assignRoleToUserGroup($role, $userGroup);
2566
2567
        // Unassign group from role
2568
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2569
2570
        // The assignments array will not contain the new role<->group assignment
2571
        $roleAssignments = $roleService->getRoleAssignments($role);
2572
        /* END: Use Case */
2573
2574
        // Members + Editors + Partners
2575
        $this->assertEquals(3, count($roleAssignments));
2576
    }
2577
2578
    /**
2579
     * Test for the unassignRoleFromUserGroup() method.