Code Duplication    Length = 34-34 lines in 2 locations

eZ/Publish/Core/Repository/Tests/Service/Integration/LocationBase.php 1 location

@@ 117-150 (lines=34) @@
114
     *
115
     * @return \eZ\Publish\API\Repository\Values\Content\Content
116
     */
117
    protected function createTestContentLocation($parentLocationId)
118
    {
119
        $contentService = $this->repository->getContentService();
120
        $contentTypeService = $this->repository->getContentTypeService();
121
        // User Group content type
122
        $contentType = $contentTypeService->loadContentType(3);
123
124
        $contentCreate = $contentService->newContentCreateStruct($contentType, 'eng-GB');
125
        $contentCreate->setField('name', 'dummy value');
126
        $contentCreate->sectionId = 1;
127
        $contentCreate->ownerId = 14;
128
        $contentCreate->remoteId = md5(uniqid(get_class($this), true));
129
        $contentCreate->alwaysAvailable = true;
130
131
        $locationCreates = array(
132
            new LocationCreateStruct(
133
                array(
134
                    //priority = 0
135
                    //hidden = false
136
                    'remoteId' => md5(uniqid(get_class($this), true)),
137
                    //sortField = Location::SORT_FIELD_NAME
138
                    //sortOrder = Location::SORT_ORDER_ASC
139
                    'parentLocationId' => $parentLocationId,
140
                )
141
            ),
142
        );
143
144
        return $contentService->publishVersion(
145
            $contentService->createContent(
146
                $contentCreate,
147
                $locationCreates
148
            )->versionInfo
149
        );
150
    }
151
152
    /**
153
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo

eZ/Publish/Core/Repository/Tests/Service/Integration/TrashBase.php 1 location

@@ 441-474 (lines=34) @@
438
     *
439
     * @return \eZ\Publish\API\Repository\Values\Content\Content
440
     */
441
    protected function createTestContentLocation($parentLocationId)
442
    {
443
        $contentService = $this->repository->getContentService();
444
        $contentTypeService = $this->repository->getContentTypeService();
445
        // User Group content type
446
        $contentType = $contentTypeService->loadContentType(3);
447
448
        $contentCreate = $contentService->newContentCreateStruct($contentType, 'eng-GB');
449
        $contentCreate->setField('name', 'dummy value');
450
        $contentCreate->sectionId = 1;
451
        $contentCreate->ownerId = 14;
452
        $contentCreate->remoteId = md5(uniqid(get_class($this), true));
453
        $contentCreate->alwaysAvailable = true;
454
455
        $locationCreates = array(
456
            new LocationCreateStruct(
457
                array(
458
                    //priority = 0
459
                    //hidden = false
460
                    'remoteId' => md5(uniqid(get_class($this), true)),
461
                    //sortField = Location::SORT_FIELD_NAME
462
                    //sortOrder = Location::SORT_ORDER_ASC
463
                    'parentLocationId' => $parentLocationId,
464
                )
465
            ),
466
        );
467
468
        return $contentService->publishVersion(
469
            $contentService->createContent(
470
                $contentCreate,
471
                $locationCreates
472
            )->versionInfo
473
        );
474
    }
475
}
476