Code Duplication    Length = 36-36 lines in 2 locations

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

@@ 50-85 (lines=36) @@
47
    /**
48
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
49
     */
50
    protected function createTestContentType()
51
    {
52
        $repository = $this->getRepository();
53
        $contentTypeService = $repository->getContentTypeService();
54
55
        $createStruct = $contentTypeService->newContentTypeCreateStruct('test-type');
56
        $createStruct->mainLanguageCode = 'eng-GB';
57
        $createStruct->names = array('eng-GB' => 'Test type');
58
        $createStruct->creatorId = 14;
59
        $createStruct->creationDate = new DateTime();
60
61
        $fieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('search_field', 'ezinteger');
62
        $fieldCreate->names = array('eng-GB' => 'Search field');
63
        $fieldCreate->fieldGroup = 'main';
64
        $fieldCreate->position = 1;
65
        $fieldCreate->isTranslatable = true;
66
        $fieldCreate->isSearchable = true;
67
68
        $createStruct->addFieldDefinition($fieldCreate);
69
70
        $fieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('sort_field', 'ezinteger');
71
        $fieldCreate->names = array('eng-GB' => 'Sort field');
72
        $fieldCreate->fieldGroup = 'main';
73
        $fieldCreate->position = 2;
74
        $fieldCreate->isTranslatable = false;
75
        $fieldCreate->isSearchable = true;
76
77
        $createStruct->addFieldDefinition($fieldCreate);
78
79
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
80
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, array($contentGroup));
81
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
82
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
83
84
        return $contentType;
85
    }
86
87
    /**
88
     * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType

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

@@ 1586-1621 (lines=36) @@
1583
    /**
1584
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
1585
     */
1586
    protected function createTestContentType()
1587
    {
1588
        $repository = $this->getRepository();
1589
        $contentTypeService = $repository->getContentTypeService();
1590
1591
        $createStruct = $contentTypeService->newContentTypeCreateStruct('test-type');
1592
        $createStruct->mainLanguageCode = 'eng-GB';
1593
        $createStruct->names = array('eng-GB' => 'Test type');
1594
        $createStruct->creatorId = 14;
1595
        $createStruct->creationDate = new \DateTime();
1596
1597
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('integer', 'ezinteger');
1598
        $translatableFieldCreate->names = array('eng-GB' => 'Simple translatable integer field');
1599
        $translatableFieldCreate->fieldGroup = 'main';
1600
        $translatableFieldCreate->position = 1;
1601
        $translatableFieldCreate->isTranslatable = true;
1602
        $translatableFieldCreate->isSearchable = true;
1603
1604
        $createStruct->addFieldDefinition($translatableFieldCreate);
1605
1606
        $nonTranslatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('integer2', 'ezinteger');
1607
        $nonTranslatableFieldCreate->names = array('eng-GB' => 'Simple non-translatable integer field');
1608
        $nonTranslatableFieldCreate->fieldGroup = 'main';
1609
        $nonTranslatableFieldCreate->position = 2;
1610
        $nonTranslatableFieldCreate->isTranslatable = false;
1611
        $nonTranslatableFieldCreate->isSearchable = true;
1612
1613
        $createStruct->addFieldDefinition($nonTranslatableFieldCreate);
1614
1615
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
1616
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, array($contentGroup));
1617
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
1618
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
1619
1620
        return $contentType;
1621
    }
1622
1623
    /**
1624
     * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType