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

@@ 2732-2758 (lines=27) @@
2729
    /**
2730
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
2731
     */
2732
    protected function createTestPlaceContentType()
2733
    {
2734
        $repository = $this->getRepository();
2735
        $contentTypeService = $repository->getContentTypeService();
2736
2737
        $createStruct = $contentTypeService->newContentTypeCreateStruct('testtype');
2738
        $createStruct->mainLanguageCode = 'eng-GB';
2739
        $createStruct->names = array('eng-GB' => 'Test type');
2740
        $createStruct->creatorId = 14;
2741
        $createStruct->creationDate = new \DateTime();
2742
2743
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('maplocation', 'ezgmaplocation');
2744
        $translatableFieldCreate->names = array('eng-GB' => 'Map location field');
2745
        $translatableFieldCreate->fieldGroup = 'main';
2746
        $translatableFieldCreate->position = 1;
2747
        $translatableFieldCreate->isTranslatable = false;
2748
        $translatableFieldCreate->isSearchable = true;
2749
2750
        $createStruct->addFieldDefinition($translatableFieldCreate);
2751
2752
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
2753
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, array($contentGroup));
2754
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
2755
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
2756
2757
        return $contentType;
2758
    }
2759
2760
    /**
2761
     * Test for the findContent() method.