Code Duplication    Length = 21-22 lines in 2 locations

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

@@ 2379-2400 (lines=22) @@
2376
     * @covers \eZ\Publish\Core\Repository\ContentService::createContent
2377
     * @dataProvider providerForTestCreateContentThrowsContentFieldValidationException
2378
     */
2379
    public function testCreateContentThrowsContentFieldValidationException($mainLanguageCode, $structFields)
2380
    {
2381
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class);
2382
        $this->expectExceptionMessage('Content fields did not validate');
2383
2384
        $fieldDefinitions = $this->fixturesForTestCreateContentNonRedundantFieldSetComplex();
2385
        list($contentCreateStruct, $allFieldErrors) =
2386
            $this->assertForTestCreateContentThrowsContentFieldValidationException(
2387
                $mainLanguageCode,
2388
                $structFields,
2389
                $fieldDefinitions
2390
            );
2391
2392
        $mockedService = $this->getPartlyMockedContentService();
2393
2394
        try {
2395
            $mockedService->createContent($contentCreateStruct);
2396
        } catch (ContentFieldValidationException $e) {
2397
            $this->assertEquals($allFieldErrors, $e->getFieldErrors());
2398
            throw $e;
2399
        }
2400
    }
2401
2402
    /**
2403
     * Test for the createContent() method.
@@ 5294-5314 (lines=21) @@
5291
     * @covers \eZ\Publish\Core\Repository\ContentService::updateContent
5292
     * @dataProvider providerForTestUpdateContentThrowsContentFieldValidationException
5293
     */
5294
    public function testUpdateContentThrowsContentFieldValidationException($initialLanguageCode, $structFields, $spiField, $allFieldErrors)
5295
    {
5296
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class);
5297
        $this->expectExceptionMessage('Content fields did not validate');
5298
5299
        list($existingFields, $fieldDefinitions) = $this->fixturesForTestUpdateContentNonRedundantFieldSetComplex();
5300
        list($versionInfo, $contentUpdateStruct) =
5301
            $this->assertForTestUpdateContentThrowsContentFieldValidationException(
5302
                $initialLanguageCode,
5303
                $structFields,
5304
                $existingFields,
5305
                $fieldDefinitions
5306
            );
5307
5308
        try {
5309
            $this->partlyMockedContentService->updateContent($versionInfo, $contentUpdateStruct);
5310
        } catch (ContentFieldValidationException $e) {
5311
            $this->assertEquals($allFieldErrors, $e->getFieldErrors());
5312
            throw $e;
5313
        }
5314
    }
5315
5316
    /**
5317
     * Test for the updateContent() method.