Code Duplication    Length = 21-22 lines in 3 locations

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

@@ 1445-1466 (lines=22) @@
1442
     * @covers \eZ\Publish\Core\Repository\ContentService::createContent
1443
     * @dataProvider providerForTestCreateContentNonRedundantFieldSet1
1444
     */
1445
    public function testCreateContentNonRedundantFieldSet1($mainLanguageCode, $structFields, $spiFields)
1446
    {
1447
        $fieldDefinitions = [
1448
            new FieldDefinition(
1449
                [
1450
                    'id' => 'fieldDefinitionId',
1451
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
1452
                    'isTranslatable' => false,
1453
                    'identifier' => 'identifier',
1454
                    'isRequired' => false,
1455
                    'defaultValue' => 'defaultValue',
1456
                ]
1457
            ),
1458
        ];
1459
1460
        $this->assertForTestCreateContentNonRedundantFieldSet(
1461
            $mainLanguageCode,
1462
            $structFields,
1463
            $spiFields,
1464
            $fieldDefinitions
1465
        );
1466
    }
1467
1468
    public function providerForTestCreateContentNonRedundantFieldSet2()
1469
    {
@@ 2011-2031 (lines=21) @@
2008
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentValidationException
2009
     * @expectedExceptionMessage A value is set for non translatable field definition 'identifier' with language 'eng-US'
2010
     */
2011
    public function testCreateContentThrowsContentValidationExceptionTranslation($mainLanguageCode, $structFields)
2012
    {
2013
        $fieldDefinitions = [
2014
            new FieldDefinition(
2015
                [
2016
                    'id' => 'fieldDefinitionId1',
2017
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
2018
                    'isTranslatable' => false,
2019
                    'identifier' => 'identifier',
2020
                    'isRequired' => false,
2021
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
2022
                ]
2023
            ),
2024
        ];
2025
2026
        $this->assertForCreateContentContentValidationException(
2027
            $mainLanguageCode,
2028
            $structFields,
2029
            $fieldDefinitions
2030
        );
2031
    }
2032
2033
    /**
2034
     * Asserts behaviour necessary for testing ContentFieldValidationException because of required
@@ 4806-4826 (lines=21) @@
4803
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentValidationException
4804
     * @expectedExceptionMessage A value is set for non translatable field definition 'identifier' with language 'eng-US'
4805
     */
4806
    public function testUpdateContentThrowsContentValidationExceptionTranslation($initialLanguageCode, $structFields)
4807
    {
4808
        $fieldDefinitions = [
4809
            new FieldDefinition(
4810
                [
4811
                    'id' => 'fieldDefinitionId1',
4812
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
4813
                    'isTranslatable' => false,
4814
                    'identifier' => 'identifier',
4815
                    'isRequired' => false,
4816
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
4817
                ]
4818
            ),
4819
        ];
4820
4821
        $this->assertForUpdateContentContentValidationException(
4822
            $initialLanguageCode,
4823
            $structFields,
4824
            $fieldDefinitions
4825
        );
4826
    }
4827
4828
    public function assertForTestUpdateContentRequiredField(
4829
        $initialLanguageCode,