Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 1695-1715 (lines=21) @@
1692
     * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUser()
1693
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testGetRoleAssignments
1694
     */
1695
    public function testAssignRoleToUser()
1696
    {
1697
        $repository = $this->getRepository();
1698
        $roleService = $repository->getRoleService();
1699
1700
        /* BEGIN: Use Case */
1701
        $user = $this->createUserVersion1();
1702
1703
        // Load the existing "Administrator" role
1704
        $role = $roleService->loadRoleByIdentifier('Administrator');
1705
1706
        // Assign the "Administrator" role to the newly created user
1707
        $roleService->assignRoleToUser($role, $user);
1708
1709
        // The assignments array will contain the new role<->user assignment
1710
        $roleAssignments = $roleService->getRoleAssignments($role);
1711
        /* END: Use Case */
1712
1713
        // Administrator + Example User
1714
        $this->assertCount(2, $roleAssignments);
1715
    }
1716
1717
    /**
1718
     * Test for the assignRoleToUser() method.
@@ 2109-2129 (lines=21) @@
2106
     * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup()
2107
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testGetRoleAssignments
2108
     */
2109
    public function testAssignRoleToUserGroup()
2110
    {
2111
        $repository = $this->getRepository();
2112
        $roleService = $repository->getRoleService();
2113
2114
        /* BEGIN: Use Case */
2115
        $userGroup = $this->createUserGroupVersion1();
2116
2117
        // Load the existing "Administrator" role
2118
        $role = $roleService->loadRoleByIdentifier('Administrator');
2119
2120
        // Assign the "Administrator" role to the newly created user group
2121
        $roleService->assignRoleToUserGroup($role, $userGroup);
2122
2123
        // The assignments array will contain the new role<->group assignment
2124
        $roleAssignments = $roleService->getRoleAssignments($role);
2125
        /* END: Use Case */
2126
2127
        // Administrator + Example Group
2128
        $this->assertCount(2, $roleAssignments);
2129
    }
2130
2131
    /**
2132
     * Test for the assignRoleToUserGroup() method.