Code Duplication    Length = 16-19 lines in 3 locations

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

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

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

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