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

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