Code Duplication    Length = 27-27 lines in 2 locations

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

@@ 297-323 (lines=27) @@
294
    /**
295
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
296
     */
297
    protected function createTestPlaceContentType()
298
    {
299
        $repository = $this->getRepository();
300
        $contentTypeService = $repository->getContentTypeService();
301
302
        $createStruct = $contentTypeService->newContentTypeCreateStruct('testtype');
303
        $createStruct->mainLanguageCode = 'eng-GB';
304
        $createStruct->names = array('eng-GB' => 'Test type');
305
        $createStruct->creatorId = 14;
306
        $createStruct->creationDate = new \DateTime();
307
308
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('maplocation', 'ezgmaplocation');
309
        $translatableFieldCreate->names = array('eng-GB' => 'Map location field');
310
        $translatableFieldCreate->fieldGroup = 'main';
311
        $translatableFieldCreate->position = 1;
312
        $translatableFieldCreate->isTranslatable = false;
313
        $translatableFieldCreate->isSearchable = true;
314
315
        $createStruct->addFieldDefinition($translatableFieldCreate);
316
317
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
318
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, array($contentGroup));
319
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
320
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
321
322
        return $contentType;
323
    }
324
325
    /**
326
     * Test for the findLocations() method.

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

@@ 2857-2883 (lines=27) @@
2854
    /**
2855
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
2856
     */
2857
    protected function createTestPlaceContentType()
2858
    {
2859
        $repository = $this->getRepository();
2860
        $contentTypeService = $repository->getContentTypeService();
2861
2862
        $createStruct = $contentTypeService->newContentTypeCreateStruct('testtype');
2863
        $createStruct->mainLanguageCode = 'eng-GB';
2864
        $createStruct->names = array('eng-GB' => 'Test type');
2865
        $createStruct->creatorId = 14;
2866
        $createStruct->creationDate = new \DateTime();
2867
2868
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('maplocation', 'ezgmaplocation');
2869
        $translatableFieldCreate->names = array('eng-GB' => 'Map location field');
2870
        $translatableFieldCreate->fieldGroup = 'main';
2871
        $translatableFieldCreate->position = 1;
2872
        $translatableFieldCreate->isTranslatable = false;
2873
        $translatableFieldCreate->isSearchable = true;
2874
2875
        $createStruct->addFieldDefinition($translatableFieldCreate);
2876
2877
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
2878
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, array($contentGroup));
2879
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
2880
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
2881
2882
        return $contentType;
2883
    }
2884
2885
    /**
2886
     * Test for the findContent() method.