Code Duplication    Length = 27-27 lines in 2 locations

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

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

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

@@ 2843-2869 (lines=27) @@
2840
    /**
2841
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
2842
     */
2843
    protected function createTestPlaceContentType()
2844
    {
2845
        $repository = $this->getRepository();
2846
        $contentTypeService = $repository->getContentTypeService();
2847
2848
        $createStruct = $contentTypeService->newContentTypeCreateStruct('testtype');
2849
        $createStruct->mainLanguageCode = 'eng-GB';
2850
        $createStruct->names = array('eng-GB' => 'Test type');
2851
        $createStruct->creatorId = 14;
2852
        $createStruct->creationDate = new \DateTime();
2853
2854
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('maplocation', 'ezgmaplocation');
2855
        $translatableFieldCreate->names = array('eng-GB' => 'Map location field');
2856
        $translatableFieldCreate->fieldGroup = 'main';
2857
        $translatableFieldCreate->position = 1;
2858
        $translatableFieldCreate->isTranslatable = false;
2859
        $translatableFieldCreate->isSearchable = true;
2860
2861
        $createStruct->addFieldDefinition($translatableFieldCreate);
2862
2863
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
2864
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, array($contentGroup));
2865
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
2866
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
2867
2868
        return $contentType;
2869
    }
2870
2871
    /**
2872
     * Test for the findContent() method.