Code Duplication    Length = 16-22 lines in 3 locations

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

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

@@ 2886-2907 (lines=22) @@
2883
     *
2884
     * @return \eZ\Publish\API\Repository\Values\Content\Content published Content
2885
     */
2886
    private function publishContentWithParentLocation($contentName, $parentLocationId)
2887
    {
2888
        $repository = $this->getRepository(false);
2889
        $locationService = $repository->getLocationService();
2890
2891
        $contentService = $repository->getContentService();
2892
        $contentTypeService = $repository->getContentTypeService();
2893
2894
        $contentCreateStruct = $contentService->newContentCreateStruct(
2895
            $contentTypeService->loadContentTypeByIdentifier('folder'),
2896
            'eng-US'
2897
        );
2898
        $contentCreateStruct->setField('name', $contentName);
2899
        $contentDraft = $contentService->createContent(
2900
            $contentCreateStruct,
2901
            [
2902
                $locationService->newLocationCreateStruct($parentLocationId),
2903
            ]
2904
        );
2905
2906
        return $contentService->publishVersion($contentDraft->versionInfo);
2907
    }
2908
}
2909