Code Duplication    Length = 19-21 lines in 2 locations

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

@@ 442-462 (lines=21) @@
439
     * @see \eZ\Publish\API\Repository\RoleService::loadRoleDraft()
440
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleDraft
441
     */
442
    public function testLoadRoleDraft()
443
    {
444
        $repository = $this->getRepository();
445
446
        /* BEGIN: Use Case */
447
448
        $roleService = $repository->getRoleService();
449
        $roleCreate = $roleService->newRoleCreateStruct('roleName');
450
451
        // @todo uncomment when support for multilingual names and descriptions is added EZP-24776
452
        // $roleCreate->mainLanguageCode = 'eng-US';
453
454
        $roleDraft = $roleService->createRole($roleCreate);
455
456
        // Load the newly created role by its ID
457
        $role = $roleService->loadRoleDraft($roleDraft->id);
458
459
        /* END: Use Case */
460
461
        $this->assertEquals('roleName', $role->identifier);
462
    }
463
464
    public function testLoadRoleDraftByRoleId()
465
    {
@@ 849-867 (lines=19) @@
846
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
847
     * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleDraft
848
     */
849
    public function testDeleteRoleDraft()
850
    {
851
        $repository = $this->getRepository();
852
853
        /* BEGIN: Use Case */
854
        $roleService = $repository->getRoleService();
855
        $roleCreate = $roleService->newRoleCreateStruct('newRole');
856
857
        // @todo uncomment when support for multilingual names and descriptions is added EZP-24776
858
        // $roleCreate->mainLanguageCode = 'eng-US';
859
860
        $roleDraft = $roleService->createRole($roleCreate);
861
        $roleID = $roleDraft->id;
862
        $roleService->deleteRoleDraft($roleDraft);
863
864
        // This call will fail with a NotFoundException, because the draft no longer exists
865
        $roleService->loadRoleDraft($roleID);
866
        /* END: Use Case */
867
    }
868
869
    /**
870
     * Test for the newPolicyCreateStruct() method.