Code Duplication    Length = 16-19 lines in 3 locations

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

@@ 439-456 (lines=18) @@
436
     * @see \eZ\Publish\API\Repository\SectionService::loadSectionByIdentifier()
437
     * @depends eZ\Publish\API\Repository\Tests\SectionServiceTest::testCreateSection
438
     */
439
    public function testLoadSectionByIdentifier()
440
    {
441
        $repository = $this->getRepository();
442
443
        /* BEGIN: Use Case */
444
        $sectionService = $repository->getSectionService();
445
446
        $sectionCreate = $sectionService->newSectionCreateStruct();
447
        $sectionCreate->name = 'Test Section';
448
        $sectionCreate->identifier = 'uniqueKey';
449
450
        $sectionId = $sectionService->createSection($sectionCreate)->id;
451
452
        $section = $sectionService->loadSectionByIdentifier('uniqueKey');
453
        /* END: Use Case */
454
455
        $this->assertEquals($sectionId, $section->id);
456
    }
457
458
    /**
459
     * Test for the loadSectionByIdentifier() method.

eZ/Publish/Core/Repository/Tests/Service/Integration/SectionBase.php 2 locations

@@ 148-166 (lines=19) @@
145
     *
146
     * @covers \eZ\Publish\Core\Repository\SectionService::updateSection
147
     */
148
    public function testUpdateSection()
149
    {
150
        $sectionService = $this->repository->getSectionService();
151
152
        $loadedSection = $sectionService->loadSection(1);
153
154
        $sectionUpdateStruct = $sectionService->newSectionUpdateStruct();
155
        $sectionUpdateStruct->identifier = 'test';
156
        $sectionUpdateStruct->name = 'Test';
157
158
        $updatedSection = $sectionService->updateSection($loadedSection, $sectionUpdateStruct);
159
160
        self::assertEquals($loadedSection->id, $updatedSection->id);
161
162
        $this->assertStructPropertiesCorrect(
163
            $sectionUpdateStruct,
164
            $updatedSection
165
        );
166
    }
167
168
    /**
169
     * Test service function for updating sections.
@@ 301-316 (lines=16) @@
298
     *
299
     * @covers \eZ\Publish\Core\Repository\SectionService::assignSection
300
     */
301
    public function testAssignSection()
302
    {
303
        $sectionService = $this->repository->getSectionService();
304
        $contentService = $this->repository->getContentService();
305
306
        $section = $sectionService->loadSection(1);
307
        $contentInfo = $contentService->loadContentInfo(4);
308
309
        self::assertEquals(2, $contentInfo->sectionId);
310
311
        $sectionService->assignSection($contentInfo, $section);
312
313
        $contentInfo = $contentService->loadContentInfo(4);
314
315
        self::assertEquals($section->id, $contentInfo->sectionId);
316
    }
317
318
    /**
319
     * Test service function for deleting sections.