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/LocationServiceTest.php 1 location

@@ 2907-2928 (lines=22) @@
2904
     *
2905
     * @return \eZ\Publish\API\Repository\Values\Content\Content published Content
2906
     */
2907
    private function publishContentWithParentLocation($contentName, $parentLocationId)
2908
    {
2909
        $repository = $this->getRepository(false);
2910
        $locationService = $repository->getLocationService();
2911
2912
        $contentService = $repository->getContentService();
2913
        $contentTypeService = $repository->getContentTypeService();
2914
2915
        $contentCreateStruct = $contentService->newContentCreateStruct(
2916
            $contentTypeService->loadContentTypeByIdentifier('folder'),
2917
            'eng-US'
2918
        );
2919
        $contentCreateStruct->setField('name', $contentName);
2920
        $contentDraft = $contentService->createContent(
2921
            $contentCreateStruct,
2922
            [
2923
                $locationService->newLocationCreateStruct($parentLocationId),
2924
            ]
2925
        );
2926
2927
        return $contentService->publishVersion($contentDraft->versionInfo);
2928
    }
2929
}
2930

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

@@ 956-971 (lines=16) @@
953
     *
954
     * @return \eZ\Publish\API\Repository\Values\Content\Content
955
     */
956
    protected function createNewContentInPlaceTrashedOne(Repository $repository, $parentLocationId)
957
    {
958
        $contentService = $repository->getContentService();
959
        $locationService = $repository->getLocationService();
960
        $contentTypeService = $repository->getContentTypeService();
961
962
        $contentType = $contentTypeService->loadContentTypeByIdentifier('forum');
963
        $newContent = $contentService->newContentCreateStruct($contentType, 'eng-US');
964
        $newContent->setField('name', 'Media');
965
966
        $location = $locationService->newLocationCreateStruct($parentLocationId);
967
968
        $draftContent = $contentService->createContent($newContent, [$location]);
969
970
        return $contentService->publishVersion($draftContent->versionInfo);
971
    }
972
973
    /**
974
     * @param URLAliasService $urlAliasService