Code Duplication    Length = 21-22 lines in 2 locations

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

@@ 653-674 (lines=22) @@
650
     * @see \eZ\Publish\API\Repository\RoleService::loadRoleByIdentifier()
651
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRole
652
     */
653
    public function testLoadRoleByIdentifier()
654
    {
655
        $repository = $this->getRepository();
656
657
        /* BEGIN: Use Case */
658
659
        $roleService = $repository->getRoleService();
660
        $roleCreate = $roleService->newRoleCreateStruct('roleName');
661
662
        // @todo uncomment when support for multilingual names and descriptions is added EZP-24776
663
        // $roleCreate->mainLanguageCode = 'eng-US';
664
665
        $roleDraft = $roleService->createRole($roleCreate);
666
        $roleService->publishRoleDraft($roleDraft);
667
668
        // Load the newly created role by its identifier
669
        $role = $roleService->loadRoleByIdentifier('roleName');
670
671
        /* END: Use Case */
672
673
        $this->assertEquals('roleName', $role->identifier);
674
    }
675
676
    /**
677
     * Test for the loadRoleByIdentifier() method.
@@ 2496-2516 (lines=21) @@
2493
     * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup()
2494
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testGetRoleAssignments
2495
     */
2496
    public function testAssignRoleToUserGroup()
2497
    {
2498
        $repository = $this->getRepository();
2499
        $roleService = $repository->getRoleService();
2500
2501
        /* BEGIN: Use Case */
2502
        $userGroup = $this->createUserGroupVersion1();
2503
2504
        // Load the existing "Administrator" role
2505
        $role = $roleService->loadRoleByIdentifier('Administrator');
2506
2507
        // Assign the "Administrator" role to the newly created user group
2508
        $roleService->assignRoleToUserGroup($role, $userGroup);
2509
2510
        // The assignments array will contain the new role<->group assignment
2511
        $roleAssignments = $roleService->getRoleAssignments($role);
2512
        /* END: Use Case */
2513
2514
        // Administrator + Example Group
2515
        $this->assertEquals(2, count($roleAssignments));
2516
    }
2517
2518
    /**
2519
     * Test for the assignRoleToUserGroup() method.