Code Duplication    Length = 27-27 lines in 2 locations

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

@@ 312-338 (lines=27) @@
309
    /**
310
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
311
     */
312
    protected function createTestPlaceContentType()
313
    {
314
        $repository = $this->getRepository();
315
        $contentTypeService = $repository->getContentTypeService();
316
317
        $createStruct = $contentTypeService->newContentTypeCreateStruct('testtype');
318
        $createStruct->mainLanguageCode = 'eng-GB';
319
        $createStruct->names = ['eng-GB' => 'Test type'];
320
        $createStruct->creatorId = 14;
321
        $createStruct->creationDate = new \DateTime();
322
323
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('maplocation', 'ezgmaplocation');
324
        $translatableFieldCreate->names = ['eng-GB' => 'Map location field'];
325
        $translatableFieldCreate->fieldGroup = 'main';
326
        $translatableFieldCreate->position = 1;
327
        $translatableFieldCreate->isTranslatable = false;
328
        $translatableFieldCreate->isSearchable = true;
329
330
        $createStruct->addFieldDefinition($translatableFieldCreate);
331
332
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
333
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, [$contentGroup]);
334
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
335
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
336
337
        return $contentType;
338
    }
339
340
    /**
341
     * Test for the findLocations() method.

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

@@ 2623-2649 (lines=27) @@
2620
    /**
2621
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
2622
     */
2623
    protected function createTestPlaceContentType()
2624
    {
2625
        $repository = $this->getRepository();
2626
        $contentTypeService = $repository->getContentTypeService();
2627
2628
        $createStruct = $contentTypeService->newContentTypeCreateStruct('testtype');
2629
        $createStruct->mainLanguageCode = 'eng-GB';
2630
        $createStruct->names = ['eng-GB' => 'Test type'];
2631
        $createStruct->creatorId = 14;
2632
        $createStruct->creationDate = new \DateTime();
2633
2634
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('maplocation', 'ezgmaplocation');
2635
        $translatableFieldCreate->names = ['eng-GB' => 'Map location field'];
2636
        $translatableFieldCreate->fieldGroup = 'main';
2637
        $translatableFieldCreate->position = 1;
2638
        $translatableFieldCreate->isTranslatable = false;
2639
        $translatableFieldCreate->isSearchable = true;
2640
2641
        $createStruct->addFieldDefinition($translatableFieldCreate);
2642
2643
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
2644
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, [$contentGroup]);
2645
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
2646
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
2647
2648
        return $contentType;
2649
    }
2650
2651
    /**
2652
     * Test for the findContent() method.