Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 1832-1852 (lines=21) @@
1829
     * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUser()
1830
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testGetRoleAssignments
1831
     */
1832
    public function testAssignRoleToUser()
1833
    {
1834
        $repository = $this->getRepository();
1835
        $roleService = $repository->getRoleService();
1836
1837
        /* BEGIN: Use Case */
1838
        $user = $this->createUserVersion1();
1839
1840
        // Load the existing "Administrator" role
1841
        $role = $roleService->loadRoleByIdentifier('Administrator');
1842
1843
        // Assign the "Administrator" role to the newly created user
1844
        $roleService->assignRoleToUser($role, $user);
1845
1846
        // The assignments array will contain the new role<->user assignment
1847
        $roleAssignments = $roleService->getRoleAssignments($role);
1848
        /* END: Use Case */
1849
1850
        // Administrator + Example User
1851
        $this->assertCount(2, $roleAssignments);
1852
    }
1853
1854
    /**
1855
     * Test for the assignRoleToUser() method.
@@ 2246-2266 (lines=21) @@
2243
     * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup()
2244
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testGetRoleAssignments
2245
     */
2246
    public function testAssignRoleToUserGroup()
2247
    {
2248
        $repository = $this->getRepository();
2249
        $roleService = $repository->getRoleService();
2250
2251
        /* BEGIN: Use Case */
2252
        $userGroup = $this->createUserGroupVersion1();
2253
2254
        // Load the existing "Administrator" role
2255
        $role = $roleService->loadRoleByIdentifier('Administrator');
2256
2257
        // Assign the "Administrator" role to the newly created user group
2258
        $roleService->assignRoleToUserGroup($role, $userGroup);
2259
2260
        // The assignments array will contain the new role<->group assignment
2261
        $roleAssignments = $roleService->getRoleAssignments($role);
2262
        /* END: Use Case */
2263
2264
        // Administrator + Example Group
2265
        $this->assertCount(2, $roleAssignments);
2266
    }
2267
2268
    /**
2269
     * Test for the assignRoleToUserGroup() method.