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.
@@ 2358-2378 (lines=21) @@
2355
     * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup()
2356
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testGetRoleAssignments
2357
     */
2358
    public function testAssignRoleToUserGroup()
2359
    {
2360
        $repository = $this->getRepository();
2361
        $roleService = $repository->getRoleService();
2362
2363
        /* BEGIN: Use Case */
2364
        $userGroup = $this->createUserGroupVersion1();
2365
2366
        // Load the existing "Administrator" role
2367
        $role = $roleService->loadRoleByIdentifier('Administrator');
2368
2369
        // Assign the "Administrator" role to the newly created user group
2370
        $roleService->assignRoleToUserGroup($role, $userGroup);
2371
2372
        // The assignments array will contain the new role<->group assignment
2373
        $roleAssignments = $roleService->getRoleAssignments($role);
2374
        /* END: Use Case */
2375
2376
        // Administrator + Example Group
2377
        $this->assertEquals(2, count($roleAssignments));
2378
    }
2379
2380
    /**
2381
     * Test for the assignRoleToUserGroup() method.