Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 2164-2179 (lines=16) @@
2161
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2162
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2163
     */
2164
    public function testUnassignRoleFromUserThrowsInvalidArgumentException()
2165
    {
2166
        $repository = $this->getRepository();
2167
        $roleService = $repository->getRoleService();
2168
2169
        /* BEGIN: Use Case */
2170
        $user = $this->createUserVersion1();
2171
2172
        // Load the existing "Member" role
2173
        $role = $roleService->loadRoleByIdentifier('Member');
2174
2175
        // This call will fail with a "InvalidArgumentException", because the
2176
        // user does not have the "Member" role.
2177
        $roleService->unassignRoleFromUser($role, $user);
2178
        /* END: Use Case */
2179
    }
2180
2181
    /**
2182
     * Test for the getRoleAssignmentsForUser() method.
@@ 2585-2600 (lines=16) @@
2582
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2583
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUnassignRoleFromUserGroup
2584
     */
2585
    public function testUnassignRoleFromUserGroupThrowsInvalidArgumentException()
2586
    {
2587
        $repository = $this->getRepository();
2588
        $roleService = $repository->getRoleService();
2589
2590
        /* BEGIN: Use Case */
2591
        $userGroup = $this->createUserGroupVersion1();
2592
2593
        // Load the existing "Member" role
2594
        $role = $roleService->loadRoleByIdentifier('Member');
2595
2596
        // This call will fail with a "InvalidArgumentException", because the
2597
        // user group does not have the "Member" role.
2598
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2599
        /* END: Use Case */
2600
    }
2601
2602
    /**
2603
     * Test unassigning role by assignment.