Code Duplication    Length = 19-21 lines in 2 locations

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

@@ 536-556 (lines=21) @@
533
     * @see \eZ\Publish\API\Repository\RoleService::loadRoleDraft()
534
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleDraft
535
     */
536
    public function testLoadRoleDraft()
537
    {
538
        $repository = $this->getRepository();
539
540
        /* BEGIN: Use Case */
541
542
        $roleService = $repository->getRoleService();
543
        $roleCreate = $roleService->newRoleCreateStruct('roleName');
544
545
        // @todo uncomment when support for multilingual names and descriptions is added EZP-24776
546
        // $roleCreate->mainLanguageCode = 'eng-US';
547
548
        $roleDraft = $roleService->createRole($roleCreate);
549
550
        // Load the newly created role by its ID
551
        $role = $roleService->loadRoleDraft($roleDraft->id);
552
553
        /* END: Use Case */
554
555
        $this->assertEquals('roleName', $role->identifier);
556
    }
557
558
    public function testLoadRoleDraftByRoleId()
559
    {
@@ 941-959 (lines=19) @@
938
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
939
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleDraft
940
     */
941
    public function testDeleteRoleDraft()
942
    {
943
        $repository = $this->getRepository();
944
945
        /* BEGIN: Use Case */
946
        $roleService = $repository->getRoleService();
947
        $roleCreate = $roleService->newRoleCreateStruct('newRole');
948
949
        // @todo uncomment when support for multilingual names and descriptions is added EZP-24776
950
        // $roleCreate->mainLanguageCode = 'eng-US';
951
952
        $roleDraft = $roleService->createRole($roleCreate);
953
        $roleID = $roleDraft->id;
954
        $roleService->deleteRoleDraft($roleDraft);
955
956
        // This call will fail with a NotFoundException, because the draft no longer exists
957
        $roleService->loadRoleDraft($roleID);
958
        /* END: Use Case */
959
    }
960
961
    /**
962
     * Test for the newPolicyCreateStruct() method.