Code Duplication    Length = 36-36 lines in 2 locations

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

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

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

@@ 1607-1642 (lines=36) @@
1604
    /**
1605
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
1606
     */
1607
    protected function createTestContentType()
1608
    {
1609
        $repository = $this->getRepository();
1610
        $contentTypeService = $repository->getContentTypeService();
1611
1612
        $createStruct = $contentTypeService->newContentTypeCreateStruct('test-type');
1613
        $createStruct->mainLanguageCode = 'eng-GB';
1614
        $createStruct->names = array('eng-GB' => 'Test type');
1615
        $createStruct->creatorId = 14;
1616
        $createStruct->creationDate = new \DateTime();
1617
1618
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('integer', 'ezinteger');
1619
        $translatableFieldCreate->names = array('eng-GB' => 'Simple translatable integer field');
1620
        $translatableFieldCreate->fieldGroup = 'main';
1621
        $translatableFieldCreate->position = 1;
1622
        $translatableFieldCreate->isTranslatable = true;
1623
        $translatableFieldCreate->isSearchable = true;
1624
1625
        $createStruct->addFieldDefinition($translatableFieldCreate);
1626
1627
        $nonTranslatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('integer2', 'ezinteger');
1628
        $nonTranslatableFieldCreate->names = array('eng-GB' => 'Simple non-translatable integer field');
1629
        $nonTranslatableFieldCreate->fieldGroup = 'main';
1630
        $nonTranslatableFieldCreate->position = 2;
1631
        $nonTranslatableFieldCreate->isTranslatable = false;
1632
        $nonTranslatableFieldCreate->isSearchable = true;
1633
1634
        $createStruct->addFieldDefinition($nonTranslatableFieldCreate);
1635
1636
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
1637
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, array($contentGroup));
1638
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
1639
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
1640
1641
        return $contentType;
1642
    }
1643
1644
    /**
1645
     * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType