Code Duplication    Length = 24-25 lines in 2 locations

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

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

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

@@ 1368-1391 (lines=24) @@
1365
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
1366
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent
1367
     */
1368
    public function testUpdateContentThrowsBadStateException()
1369
    {
1370
        $repository = $this->getRepository();
1371
1372
        $contentService = $repository->getContentService();
1373
1374
        /* BEGIN: Use Case */
1375
        $content = $this->createContentVersion1();
1376
1377
        // Now create an update struct and modify some fields
1378
        $contentUpdateStruct = $contentService->newContentUpdateStruct();
1379
        $contentUpdateStruct->setField('title', 'An awesome² story about ezp.');
1380
        $contentUpdateStruct->setField('title', 'An awesome²³ story about ezp.', 'eng-GB');
1381
1382
        $contentUpdateStruct->initialLanguageCode = 'eng-US';
1383
1384
        // This call will fail with a "BadStateException", because $publishedContent
1385
        // is not a draft.
1386
        $contentService->updateContent(
1387
            $content->getVersionInfo(),
1388
            $contentUpdateStruct
1389
        );
1390
        /* END: Use Case */
1391
    }
1392
1393
    /**
1394
     * Test for the updateContent() method.