Code Duplication    Length = 22-24 lines in 2 locations

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

@@ 825-848 (lines=24) @@
822
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewRoleUpdateStruct
823
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleDraft
824
     */
825
    public function testUpdateRoleDraft()
826
    {
827
        $repository = $this->getRepository();
828
829
        /* BEGIN: Use Case */
830
        $roleService = $repository->getRoleService();
831
        $roleCreate = $roleService->newRoleCreateStruct('newRole');
832
833
        // @todo uncomment when support for multilingual names and descriptions is added EZP-24776
834
        // $roleCreate->mainLanguageCode = 'eng-US';
835
836
        $roleDraft = $roleService->createRole($roleCreate);
837
838
        $roleUpdate = $roleService->newRoleUpdateStruct();
839
        $roleUpdate->identifier = 'updatedRole';
840
841
        $updatedRole = $roleService->updateRoleDraft($roleDraft, $roleUpdate);
842
        /* END: Use Case */
843
844
        // Now verify that our change was saved
845
        $role = $roleService->loadRoleDraft($updatedRole->id);
846
847
        $this->assertEquals($role->identifier, 'updatedRole');
848
    }
849
850
    /**
851
     * Test for the updateRole() method.
@@ 857-878 (lines=22) @@
854
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
855
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUpdateRole
856
     */
857
    public function testUpdateRoleThrowsInvalidArgumentException()
858
    {
859
        $repository = $this->getRepository();
860
861
        /* BEGIN: Use Case */
862
        $roleService = $repository->getRoleService();
863
        $roleCreate = $roleService->newRoleCreateStruct('newRole');
864
865
        // @todo uncomment when support for multilingual names and descriptions is added EZP-24776
866
        // $roleCreate->mainLanguageCode = 'eng-US';
867
868
        $roleDraft = $roleService->createRole($roleCreate);
869
        $roleService->publishRoleDraft($roleDraft);
870
        $role = $roleService->loadRole($roleDraft->id);
871
872
        $roleUpdate = $roleService->newRoleUpdateStruct();
873
        $roleUpdate->identifier = 'Editor';
874
875
        // This call will fail with an InvalidArgumentException, because Editor is a predefined role
876
        $roleService->updateRole($role, $roleUpdate);
877
        /* END: Use Case */
878
    }
879
880
    /**
881
     * Test for the updateRoleDraft() method.