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

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