Code Duplication    Length = 15-15 lines in 2 locations

eZ/Publish/API/Repository/Tests/ContentServiceTest.php 2 locations

@@ 351-365 (lines=15) @@
348
     * @see \eZ\Publish\API\Repository\ContentService::createContent()
349
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent
350
     */
351
    public function testCreateContentThrowsInvalidArgumentExceptionOnFieldTypeNotAccept()
352
    {
353
        /* BEGIN: Use Case */
354
        $contentTypeService = $this->getRepository()->getContentTypeService();
355
356
        $contentType = $contentTypeService->loadContentTypeByIdentifier('forum');
357
358
        $contentCreate = $this->contentService->newContentCreateStruct($contentType, 'eng-US');
359
        // The name field does only accept strings and null as its values
360
        $contentCreate->setField('name', new \stdClass());
361
362
        $this->expectException(APIInvalidArgumentException::class);
363
        $draft = $this->contentService->createContent($contentCreate);
364
        /* END: Use Case */
365
    }
366
367
    /**
368
     * Test for the createContent() method.
@@ 398-412 (lines=15) @@
395
     * @see \eZ\Publish\API\Repository\ContentService::createContent()
396
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent
397
     */
398
    public function testCreateContentRequiredFieldMissing()
399
    {
400
        /* BEGIN: Use Case */
401
        $contentTypeService = $this->getRepository()->getContentTypeService();
402
        $contentType = $contentTypeService->loadContentTypeByIdentifier('forum');
403
404
        $contentCreate1 = $this->contentService->newContentCreateStruct($contentType, 'eng-US');
405
        // Required field "name" is not set
406
407
        $this->expectException(ContentFieldValidationException::class);
408
409
        // Throws a ContentFieldValidationException, since a required field is missing
410
        $draft = $this->contentService->createContent($contentCreate1);
411
        /* END: Use Case */
412
    }
413
414
    /**
415
     * Test for the createContent() method.