Code Duplication    Length = 21-22 lines in 2 locations

eZ/Publish/Core/Repository/Tests/Service/Mock/ContentTest.php 2 locations

@@ 2393-2414 (lines=22) @@
2390
     * @covers \eZ\Publish\Core\Repository\ContentService::createContent
2391
     * @dataProvider providerForTestCreateContentThrowsContentFieldValidationException
2392
     */
2393
    public function testCreateContentThrowsContentFieldValidationException($mainLanguageCode, $structFields)
2394
    {
2395
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class);
2396
        $this->expectExceptionMessage('Content fields did not validate');
2397
2398
        $fieldDefinitions = $this->fixturesForTestCreateContentNonRedundantFieldSetComplex();
2399
        list($contentCreateStruct, $allFieldErrors) =
2400
            $this->assertForTestCreateContentThrowsContentFieldValidationException(
2401
                $mainLanguageCode,
2402
                $structFields,
2403
                $fieldDefinitions
2404
            );
2405
2406
        $mockedService = $this->getPartlyMockedContentService();
2407
2408
        try {
2409
            $mockedService->createContent($contentCreateStruct);
2410
        } catch (ContentFieldValidationException $e) {
2411
            $this->assertEquals($allFieldErrors, $e->getFieldErrors());
2412
            throw $e;
2413
        }
2414
    }
2415
2416
    /**
2417
     * Test for the createContent() method.
@@ 5307-5327 (lines=21) @@
5304
     * @covers \eZ\Publish\Core\Repository\ContentService::updateContent
5305
     * @dataProvider providerForTestUpdateContentThrowsContentFieldValidationException
5306
     */
5307
    public function testUpdateContentThrowsContentFieldValidationException($initialLanguageCode, $structFields, $spiField, $allFieldErrors)
5308
    {
5309
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class);
5310
        $this->expectExceptionMessage('Content fields did not validate');
5311
5312
        list($existingFields, $fieldDefinitions) = $this->fixturesForTestUpdateContentNonRedundantFieldSetComplex();
5313
        list($versionInfo, $contentUpdateStruct) =
5314
            $this->assertForTestUpdateContentThrowsContentFieldValidationException(
5315
                $initialLanguageCode,
5316
                $structFields,
5317
                $existingFields,
5318
                $fieldDefinitions
5319
            );
5320
5321
        try {
5322
            $this->partlyMockedContentService->updateContent($versionInfo, $contentUpdateStruct);
5323
        } catch (ContentFieldValidationException $e) {
5324
            $this->assertEquals($allFieldErrors, $e->getFieldErrors());
5325
            throw $e;
5326
        }
5327
    }
5328
5329
    /**
5330
     * Test for the updateContent() method.