Code Duplication    Length = 16-21 lines in 2 locations

eZ/Publish/API/Repository/Tests/TrashServiceTest.php 1 location

@@ 716-731 (lines=16) @@
713
     *
714
     * @return \eZ\Publish\API\Repository\Values\Content\Content
715
     */
716
    protected function createNewContentInPlaceTrashedOne(Repository $repository, $parentLocationId)
717
    {
718
        $contentService = $repository->getContentService();
719
        $locationService = $repository->getLocationService();
720
        $contentTypeService = $repository->getContentTypeService();
721
722
        $contentType = $contentTypeService->loadContentTypeByIdentifier('forum');
723
        $newContent = $contentService->newContentCreateStruct($contentType, 'eng-US');
724
        $newContent->setField('name', 'Media');
725
726
        $location = $locationService->newLocationCreateStruct($parentLocationId);
727
728
        $draftContent = $contentService->createContent($newContent, [$location]);
729
730
        return $contentService->publishVersion($draftContent->versionInfo);
731
    }
732
733
    /**
734
     * @param URLAliasService $urlAliasService

eZ/Publish/API/Repository/Tests/LocationServiceTest.php 1 location

@@ 626-646 (lines=21) @@
623
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocations
624
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
625
     */
626
    public function testLoadLocationsThrowsBadStateException()
627
    {
628
        $repository = $this->getRepository();
629
630
        /* BEGIN: Use Case */
631
        $contentTypeService = $repository->getContentTypeService();
632
        $contentService = $repository->getContentService();
633
        $locationService = $repository->getLocationService();
634
635
        // Create new content, which is not published
636
        $folderType = $contentTypeService->loadContentTypeByIdentifier('folder');
637
        $contentCreate = $contentService->newContentCreateStruct($folderType, 'eng-US');
638
        $contentCreate->setField('name', 'New Folder');
639
        $content = $contentService->createContent($contentCreate);
640
641
        // Throws Exception, since $content has no published version, yet
642
        $locationService->loadLocations(
643
            $content->contentInfo
644
        );
645
        /* END: Use Case */
646
    }
647
648
    /**
649
     * Test for the loadLocations() method.