Code Duplication    Length = 21-22 lines in 2 locations

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

@@ 652-673 (lines=22) @@
649
     * @see \eZ\Publish\API\Repository\RoleService::loadRoleByIdentifier()
650
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRole
651
     */
652
    public function testLoadRoleByIdentifier()
653
    {
654
        $repository = $this->getRepository();
655
656
        /* BEGIN: Use Case */
657
658
        $roleService = $repository->getRoleService();
659
        $roleCreate = $roleService->newRoleCreateStruct('roleName');
660
661
        // @todo uncomment when support for multilingual names and descriptions is added EZP-24776
662
        // $roleCreate->mainLanguageCode = 'eng-US';
663
664
        $roleDraft = $roleService->createRole($roleCreate);
665
        $roleService->publishRoleDraft($roleDraft);
666
667
        // Load the newly created role by its identifier
668
        $role = $roleService->loadRoleByIdentifier('roleName');
669
670
        /* END: Use Case */
671
672
        $this->assertEquals('roleName', $role->identifier);
673
    }
674
675
    /**
676
     * Test for the loadRoleByIdentifier() method.
@@ 2360-2380 (lines=21) @@
2357
     * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup()
2358
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testGetRoleAssignments
2359
     */
2360
    public function testAssignRoleToUserGroup()
2361
    {
2362
        $repository = $this->getRepository();
2363
        $roleService = $repository->getRoleService();
2364
2365
        /* BEGIN: Use Case */
2366
        $userGroup = $this->createUserGroupVersion1();
2367
2368
        // Load the existing "Administrator" role
2369
        $role = $roleService->loadRoleByIdentifier('Administrator');
2370
2371
        // Assign the "Administrator" role to the newly created user group
2372
        $roleService->assignRoleToUserGroup($role, $userGroup);
2373
2374
        // The assignments array will contain the new role<->group assignment
2375
        $roleAssignments = $roleService->getRoleAssignments($role);
2376
        /* END: Use Case */
2377
2378
        // Administrator + Example Group
2379
        $this->assertEquals(2, count($roleAssignments));
2380
    }
2381
2382
    /**
2383
     * Test for the assignRoleToUserGroup() method.