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

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