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

@@ 1476-1511 (lines=36) @@
1473
    /**
1474
     * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType
1475
     */
1476
    protected function createTestContentType()
1477
    {
1478
        $repository = $this->getRepository();
1479
        $contentTypeService = $repository->getContentTypeService();
1480
1481
        $createStruct = $contentTypeService->newContentTypeCreateStruct('test-type');
1482
        $createStruct->mainLanguageCode = 'eng-GB';
1483
        $createStruct->names = array('eng-GB' => 'Test type');
1484
        $createStruct->creatorId = 14;
1485
        $createStruct->creationDate = new \DateTime();
1486
1487
        $translatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('integer', 'ezinteger');
1488
        $translatableFieldCreate->names = array('eng-GB' => 'Simple translatable integer field');
1489
        $translatableFieldCreate->fieldGroup = 'main';
1490
        $translatableFieldCreate->position = 1;
1491
        $translatableFieldCreate->isTranslatable = true;
1492
        $translatableFieldCreate->isSearchable = true;
1493
1494
        $createStruct->addFieldDefinition($translatableFieldCreate);
1495
1496
        $nonTranslatableFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('integer2', 'ezinteger');
1497
        $nonTranslatableFieldCreate->names = array('eng-GB' => 'Simple non-translatable integer field');
1498
        $nonTranslatableFieldCreate->fieldGroup = 'main';
1499
        $nonTranslatableFieldCreate->position = 2;
1500
        $nonTranslatableFieldCreate->isTranslatable = false;
1501
        $nonTranslatableFieldCreate->isSearchable = true;
1502
1503
        $createStruct->addFieldDefinition($nonTranslatableFieldCreate);
1504
1505
        $contentGroup = $contentTypeService->loadContentTypeGroupByIdentifier('Content');
1506
        $contentTypeDraft = $contentTypeService->createContentType($createStruct, array($contentGroup));
1507
        $contentTypeService->publishContentTypeDraft($contentTypeDraft);
1508
        $contentType = $contentTypeService->loadContentType($contentTypeDraft->id);
1509
1510
        return $contentType;
1511
    }
1512
1513
    /**
1514
     * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType