Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 2135-2150 (lines=16) @@
2132
     * @see \eZ\Publish\API\Repository\RoleService::unassignRoleFromUser()
2133
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2134
     */
2135
    public function testUnassignRoleFromUserThrowsInvalidArgumentException()
2136
    {
2137
        $repository = $this->getRepository();
2138
        $roleService = $repository->getRoleService();
2139
2140
        /* BEGIN: Use Case */
2141
        $user = $this->createUserVersion1();
2142
2143
        // Load the existing "Member" role
2144
        $role = $roleService->loadRoleByIdentifier('Member');
2145
2146
        // This call will fail with a "InvalidArgumentException", because the
2147
        // user does not have the "Member" role.
2148
        $roleService->unassignRoleFromUser($role, $user);
2149
        /* END: Use Case */
2150
    }
2151
2152
    /**
2153
     * Test for the getRoleAssignmentsForUser() method.
@@ 2556-2571 (lines=16) @@
2553
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
2554
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUnassignRoleFromUserGroup
2555
     */
2556
    public function testUnassignRoleFromUserGroupThrowsInvalidArgumentException()
2557
    {
2558
        $repository = $this->getRepository();
2559
        $roleService = $repository->getRoleService();
2560
2561
        /* BEGIN: Use Case */
2562
        $userGroup = $this->createUserGroupVersion1();
2563
2564
        // Load the existing "Member" role
2565
        $role = $roleService->loadRoleByIdentifier('Member');
2566
2567
        // This call will fail with a "InvalidArgumentException", because the
2568
        // user group does not have the "Member" role.
2569
        $roleService->unassignRoleFromUserGroup($role, $userGroup);
2570
        /* END: Use Case */
2571
    }
2572
2573
    /**
2574
     * Test unassigning role by assignment.