Code Duplication    Length = 27-27 lines in 2 locations

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

@@ 452-478 (lines=27) @@
449
    /**
450
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
451
     */
452
    protected function createTestPlaceContentType()
453
    {
454
        $repository = $this->getRepository();
455
        $contentTypeService = $repository->getContentTypeService();
456
457
        $createStruct = $contentTypeService->newContentTypeCreateStruct('testtype');
458
        $createStruct->mainLanguageCode = 'eng-GB';
459
        $createStruct->names = ['eng-GB' => 'Test type'];
460
        $createStruct->creatorId = 14;
461
        $createStruct->creationDate = new \DateTime();
462
463
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('maplocation', 'ezgmaplocation');
464
        $translatableFieldCreate->names = ['eng-GB' => 'Map location field'];
465
        $translatableFieldCreate->fieldGroup = 'main';
466
        $translatableFieldCreate->position = 1;
467
        $translatableFieldCreate->isTranslatable = false;
468
        $translatableFieldCreate->isSearchable = true;
469
470
        $createStruct->addFieldDefinition($translatableFieldCreate);
471
472
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
473
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, [$contentGroup]);
474
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
475
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
476
477
        return $contentType;
478
    }
479
480
    /**
481
     * Test for the findLocations() method.

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

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