Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 2155-2178 (lines=24) @@
2152
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2153
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser
2154
     */
2155
    public function testUnassignRoleFromUser()
2156
    {
2157
        $repository = $this->getRepository();
2158
        $roleService = $repository->getRoleService();
2159
2160
        /* BEGIN: Use Case */
2161
        $user = $this->createUserVersion1();
2162
2163
        // Load the existing "Member" role
2164
        $role = $roleService->loadRoleByIdentifier('Member');
2165
2166
        // Assign the "Member" role to the newly created user
2167
        $roleService->assignRoleToUser($role, $user);
2168
2169
        // Unassign user from role
2170
        $roleService->unassignRoleFromUser($role, $user);
2171
2172
        // The assignments array will not contain the new role<->user assignment
2173
        $roleAssignments = $roleService->getRoleAssignments($role);
2174
        /* END: Use Case */
2175
2176
        // Members + Editors + Partners
2177
        $this->assertEquals(3, count($roleAssignments));
2178
    }
2179
2180
    /**
2181
     * Test for the unassignRoleFromUser() method.
@@ 2605-2628 (lines=24) @@
2602
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUserGroup()
2603
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup
2604
     */
2605
    public function testUnassignRoleFromUserGroup()
2606
    {
2607
        $repository = $this->getRepository();
2608
        $roleService = $repository->getRoleService();
2609
2610
        /* BEGIN: Use Case */
2611
        $userGroup = $this->createUserGroupVersion1();
2612
2613
        // Load the existing "Member" role
2614
        $role = $roleService->loadRoleByIdentifier('Member');
2615
2616
        // Assign the "Member" role to the newly created user group
2617
        $roleService->assignRoleToUserGroup($role, $userGroup);
2618
2619
        // Unassign group from role
2620
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2621
2622
        // The assignments array will not contain the new role<->group assignment
2623
        $roleAssignments = $roleService->getRoleAssignments($role);
2624
        /* END: Use Case */
2625
2626
        // Members + Editors + Partners
2627
        $this->assertEquals(3, count($roleAssignments));
2628
    }
2629
2630
    /**
2631
     * Test for the unassignRoleFromUserGroup() method.