Code Duplication    Length = 16-22 lines in 3 locations

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

@@ 2836-2857 (lines=22) @@
2833
     *
2834
     * @return \eZ\Publish\API\Repository\Values\Content\Content published Content
2835
     */
2836
    private function publishContentWithParentLocation($contentName, $parentLocationId)
2837
    {
2838
        $repository = $this->getRepository(false);
2839
        $locationService = $repository->getLocationService();
2840
2841
        $contentService = $repository->getContentService();
2842
        $contentTypeService = $repository->getContentTypeService();
2843
2844
        $contentCreateStruct = $contentService->newContentCreateStruct(
2845
            $contentTypeService->loadContentTypeByIdentifier('folder'),
2846
            'eng-US'
2847
        );
2848
        $contentCreateStruct->setField('name', $contentName);
2849
        $contentDraft = $contentService->createContent(
2850
            $contentCreateStruct,
2851
            [
2852
                $locationService->newLocationCreateStruct($parentLocationId),
2853
            ]
2854
        );
2855
2856
        return $contentService->publishVersion($contentDraft->versionInfo);
2857
    }
2858
}
2859

eZ/Bundle/EzPublishCoreBundle/Features/Context/QueryControllerContext.php 1 location

@@ 97-118 (lines=22) @@
94
    /**
95
     * @return Content
96
     */
97
    private function createFolder()
98
    {
99
        $repository = $this->getRepository();
100
        $contentService = $repository->getContentService();
101
        $contentTypeService = $repository->getContentTypeService();
102
        $locationService = $repository->getLocationService();
103
104
        $struct = $contentService->newContentCreateStruct(
105
            $contentTypeService->loadContentTypeByIdentifier('folder'),
106
            'eng-GB'
107
        );
108
109
        $struct->setField('name', uniqid('Query Controller BDD ', true));
110
111
        $contentDraft = $contentService->createContent(
112
            $struct,
113
            [$locationService->newLocationCreateStruct(2)]
114
        );
115
        $contentService->publishVersion($contentDraft->versionInfo);
116
117
        return $contentService->loadContent($contentDraft->id);
118
    }
119
120
    /**
121
     * @Given /^a LocationChildren QueryType defined in "([^"]*)":$/

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

@@ 925-940 (lines=16) @@
922
     *
923
     * @return \eZ\Publish\API\Repository\Values\Content\Content
924
     */
925
    protected function createNewContentInPlaceTrashedOne(Repository $repository, $parentLocationId)
926
    {
927
        $contentService = $repository->getContentService();
928
        $locationService = $repository->getLocationService();
929
        $contentTypeService = $repository->getContentTypeService();
930
931
        $contentType = $contentTypeService->loadContentTypeByIdentifier('forum');
932
        $newContent = $contentService->newContentCreateStruct($contentType, 'eng-US');
933
        $newContent->setField('name', 'Media');
934
935
        $location = $locationService->newLocationCreateStruct($parentLocationId);
936
937
        $draftContent = $contentService->createContent($newContent, [$location]);
938
939
        return $contentService->publishVersion($draftContent->versionInfo);
940
    }
941
942
    /**
943
     * @param URLAliasService $urlAliasService