Code Duplication    Length = 21-22 lines in 2 locations

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

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