Code Duplication    Length = 21-22 lines in 3 locations

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

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