Code Duplication    Length = 22-23 lines in 2 locations

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

@@ 3630-3651 (lines=22) @@
3627
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
3628
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testAddRelation
3629
     */
3630
    public function testAddRelationThrowsBadStateException()
3631
    {
3632
        $repository = $this->getRepository();
3633
3634
        $contentService = $repository->getContentService();
3635
3636
        /* BEGIN: Use Case */
3637
        // RemoteId of the "Media" page of an eZ Publish demo installation
3638
        $mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262';
3639
3640
        $content = $this->createContentVersion1();
3641
3642
        $media = $contentService->loadContentInfoByRemoteId($mediaRemoteId);
3643
3644
        // This call will fail with a "BadStateException", because content is
3645
        // published and not a draft.
3646
        $contentService->addRelation(
3647
            $content->getVersionInfo(),
3648
            $media
3649
        );
3650
        /* END: Use Case */
3651
    }
3652
3653
    /**
3654
     * Test for the loadRelations() method.
@@ 4194-4216 (lines=23) @@
4191
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
4192
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testDeleteRelation
4193
     */
4194
    public function testDeleteRelationThrowsInvalidArgumentException()
4195
    {
4196
        $repository = $this->getRepository();
4197
4198
        $contentService = $repository->getContentService();
4199
4200
        /* BEGIN: Use Case */
4201
        // RemoteId of the "Media" page of an eZ Publish demo installation
4202
        $mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262';
4203
4204
        $draft = $this->createContentDraftVersion1();
4205
4206
        // Load the destination object
4207
        $media = $contentService->loadContentInfoByRemoteId($mediaRemoteId);
4208
4209
        // This call will fail with a "InvalidArgumentException", because no
4210
        // relation exists between $draft and $media.
4211
        $contentService->deleteRelation(
4212
            $draft->getVersionInfo(),
4213
            $media
4214
        );
4215
        /* END: Use Case */
4216
    }
4217
4218
    /**
4219
     * Test for the createContent() method.