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

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