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 = array('eng-GB' => 'Test type');
320
        $createStruct->creatorId = 14;
321
        $createStruct->creationDate = new \DateTime();
322
323
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('maplocation', 'ezgmaplocation');
324
        $translatableFieldCreate->names = array('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, array($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

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