Code Duplication    Length = 27-27 lines in 2 locations

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

@@ 2793-2819 (lines=27) @@
2790
    /**
2791
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
2792
     */
2793
    protected function createTestPlaceContentType()
2794
    {
2795
        $repository = $this->getRepository();
2796
        $contentTypeService = $repository->getContentTypeService();
2797
2798
        $createStruct = $contentTypeService->newContentTypeCreateStruct('testtype');
2799
        $createStruct->mainLanguageCode = 'eng-GB';
2800
        $createStruct->names = ['eng-GB' => 'Test type'];
2801
        $createStruct->creatorId = 14;
2802
        $createStruct->creationDate = new \DateTime();
2803
2804
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('maplocation', 'ezgmaplocation');
2805
        $translatableFieldCreate->names = ['eng-GB' => 'Map location field'];
2806
        $translatableFieldCreate->fieldGroup = 'main';
2807
        $translatableFieldCreate->position = 1;
2808
        $translatableFieldCreate->isTranslatable = false;
2809
        $translatableFieldCreate->isSearchable = true;
2810
2811
        $createStruct->addFieldDefinition($translatableFieldCreate);
2812
2813
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
2814
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, [$contentGroup]);
2815
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
2816
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
2817
2818
        return $contentType;
2819
    }
2820
2821
    /**
2822
     * Test for the findContent() method.

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

@@ 536-562 (lines=27) @@
533
    /**
534
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
535
     */
536
    protected function createTestPlaceContentType()
537
    {
538
        $repository = $this->getRepository();
539
        $contentTypeService = $repository->getContentTypeService();
540
541
        $createStruct = $contentTypeService->newContentTypeCreateStruct('testtype');
542
        $createStruct->mainLanguageCode = 'eng-GB';
543
        $createStruct->names = ['eng-GB' => 'Test type'];
544
        $createStruct->creatorId = 14;
545
        $createStruct->creationDate = new \DateTime();
546
547
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('maplocation', 'ezgmaplocation');
548
        $translatableFieldCreate->names = ['eng-GB' => 'Map location field'];
549
        $translatableFieldCreate->fieldGroup = 'main';
550
        $translatableFieldCreate->position = 1;
551
        $translatableFieldCreate->isTranslatable = false;
552
        $translatableFieldCreate->isSearchable = true;
553
554
        $createStruct->addFieldDefinition($translatableFieldCreate);
555
556
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
557
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, [$contentGroup]);
558
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
559
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
560
561
        return $contentType;
562
    }
563
564
    /**
565
     * Test for the findLocations() method.