Code Duplication    Length = 21-22 lines in 2 locations

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

@@ 2331-2352 (lines=22) @@
2328
     * @covers \eZ\Publish\Core\Repository\ContentService::createContent
2329
     * @dataProvider providerForTestCreateContentThrowsContentFieldValidationException
2330
     */
2331
    public function testCreateContentThrowsContentFieldValidationException($mainLanguageCode, $structFields)
2332
    {
2333
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class);
2334
        $this->expectExceptionMessage('Content fields did not validate');
2335
2336
        $fieldDefinitions = $this->fixturesForTestCreateContentNonRedundantFieldSetComplex();
2337
        list($contentCreateStruct, $allFieldErrors) =
2338
            $this->assertForTestCreateContentThrowsContentFieldValidationException(
2339
                $mainLanguageCode,
2340
                $structFields,
2341
                $fieldDefinitions
2342
            );
2343
2344
        $mockedService = $this->getPartlyMockedContentService();
2345
2346
        try {
2347
            $mockedService->createContent($contentCreateStruct);
2348
        } catch (ContentFieldValidationException $e) {
2349
            $this->assertEquals($allFieldErrors, $e->getFieldErrors());
2350
            throw $e;
2351
        }
2352
    }
2353
2354
    /**
2355
     * Test for the createContent() method.
@@ 5246-5266 (lines=21) @@
5243
     * @covers \eZ\Publish\Core\Repository\ContentService::updateContent
5244
     * @dataProvider providerForTestUpdateContentThrowsContentFieldValidationException
5245
     */
5246
    public function testUpdateContentThrowsContentFieldValidationException($initialLanguageCode, $structFields, $spiField, $allFieldErrors)
5247
    {
5248
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException::class);
5249
        $this->expectExceptionMessage('Content fields did not validate');
5250
5251
        list($existingFields, $fieldDefinitions) = $this->fixturesForTestUpdateContentNonRedundantFieldSetComplex();
5252
        list($versionInfo, $contentUpdateStruct) =
5253
            $this->assertForTestUpdateContentThrowsContentFieldValidationException(
5254
                $initialLanguageCode,
5255
                $structFields,
5256
                $existingFields,
5257
                $fieldDefinitions
5258
            );
5259
5260
        try {
5261
            $this->partlyMockedContentService->updateContent($versionInfo, $contentUpdateStruct);
5262
        } catch (ContentFieldValidationException $e) {
5263
            $this->assertEquals($allFieldErrors, $e->getFieldErrors());
5264
            throw $e;
5265
        }
5266
    }
5267
5268
    /**
5269
     * Test for the updateContent() method.