Code Duplication    Length = 15-15 lines in 2 locations

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

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