Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 268-292 (lines=25) @@
265
     *
266
     * @return \eZ\Publish\API\Repository\Values\Content\Content
267
     */
268
    protected function createMultipleLanguageDraftVersion1()
269
    {
270
        $repository = $this->getRepository();
271
272
        $contentService = $repository->getContentService();
273
274
        /* BEGIN: Inline */
275
        $draft = $this->createContentDraftVersion1();
276
277
        $contentUpdate = $contentService->newContentUpdateStruct();
278
279
        $contentUpdate->initialLanguageCode = 'eng-US';
280
281
        $contentUpdate->setField('name', 'An awesome multi-lang forum²');
282
283
        $contentUpdate->setField('name', 'An awesome multi-lang forum²³', 'eng-GB');
284
285
        $draft = $contentService->updateContent(
286
            $draft->getVersionInfo(),
287
            $contentUpdate
288
        );
289
        /* END: Inline */
290
291
        return $draft;
292
    }
293
294
    /**
295
     * Creates a published content object with versionNo=2 named

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

@@ 1545-1568 (lines=24) @@
1542
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
1543
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent
1544
     */
1545
    public function testUpdateContentThrowsBadStateException()
1546
    {
1547
        $repository = $this->getRepository();
1548
1549
        $contentService = $repository->getContentService();
1550
1551
        /* BEGIN: Use Case */
1552
        $content = $this->createContentVersion1();
1553
1554
        // Now create an update struct and modify some fields
1555
        $contentUpdateStruct = $contentService->newContentUpdateStruct();
1556
        $contentUpdateStruct->setField('title', 'An awesome² story about ezp.');
1557
        $contentUpdateStruct->setField('title', 'An awesome²³ story about ezp.', 'eng-GB');
1558
1559
        $contentUpdateStruct->initialLanguageCode = 'eng-US';
1560
1561
        // This call will fail with a "BadStateException", because $publishedContent
1562
        // is not a draft.
1563
        $contentService->updateContent(
1564
            $content->getVersionInfo(),
1565
            $contentUpdateStruct
1566
        );
1567
        /* END: Use Case */
1568
    }
1569
1570
    /**
1571
     * Test for the updateContent() method.