Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 2186-2201 (lines=16) @@
2183
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2184
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2185
     */
2186
    public function testUnassignRoleFromUserThrowsInvalidArgumentException()
2187
    {
2188
        $repository = $this->getRepository();
2189
        $roleService = $repository->getRoleService();
2190
2191
        /* BEGIN: Use Case */
2192
        $user = $this->createUserVersion1();
2193
2194
        // Load the existing "Member" role
2195
        $role = $roleService->loadRoleByIdentifier('Member');
2196
2197
        // This call will fail with a "InvalidArgumentException", because the
2198
        // user does not have the "Member" role.
2199
        $roleService->unassignRoleFromUser($role, $user);
2200
        /* END: Use Case */
2201
    }
2202
2203
    /**
2204
     * Test for the getRoleAssignmentsForUser() method.
@@ 2607-2622 (lines=16) @@
2604
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2605
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUnassignRoleFromUserGroup
2606
     */
2607
    public function testUnassignRoleFromUserGroupThrowsInvalidArgumentException()
2608
    {
2609
        $repository = $this->getRepository();
2610
        $roleService = $repository->getRoleService();
2611
2612
        /* BEGIN: Use Case */
2613
        $userGroup = $this->createUserGroupVersion1();
2614
2615
        // Load the existing "Member" role
2616
        $role = $roleService->loadRoleByIdentifier('Member');
2617
2618
        // This call will fail with a "InvalidArgumentException", because the
2619
        // user group does not have the "Member" role.
2620
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2621
        /* END: Use Case */
2622
    }
2623
2624
    /**
2625
     * Test unassigning role by assignment.