Code Duplication    Length = 21-22 lines in 3 locations

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

@@ 1457-1478 (lines=22) @@
1454
     * @covers \eZ\Publish\Core\Repository\ContentService::createContent
1455
     * @dataProvider providerForTestCreateContentNonRedundantFieldSet1
1456
     */
1457
    public function testCreateContentNonRedundantFieldSet1($mainLanguageCode, $structFields, $spiFields)
1458
    {
1459
        $fieldDefinitions = [
1460
            new FieldDefinition(
1461
                [
1462
                    'id' => 'fieldDefinitionId',
1463
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
1464
                    'isTranslatable' => false,
1465
                    'identifier' => 'identifier',
1466
                    'isRequired' => false,
1467
                    'defaultValue' => 'defaultValue',
1468
                ]
1469
            ),
1470
        ];
1471
1472
        $this->assertForTestCreateContentNonRedundantFieldSet(
1473
            $mainLanguageCode,
1474
            $structFields,
1475
            $spiFields,
1476
            $fieldDefinitions
1477
        );
1478
    }
1479
1480
    public function providerForTestCreateContentNonRedundantFieldSet2()
1481
    {
@@ 2023-2043 (lines=21) @@
2020
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentValidationException
2021
     * @expectedExceptionMessage A value is set for non translatable field definition 'identifier' with language 'eng-US'
2022
     */
2023
    public function testCreateContentThrowsContentValidationExceptionTranslation($mainLanguageCode, $structFields)
2024
    {
2025
        $fieldDefinitions = [
2026
            new FieldDefinition(
2027
                [
2028
                    'id' => 'fieldDefinitionId1',
2029
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
2030
                    'isTranslatable' => false,
2031
                    'identifier' => 'identifier',
2032
                    'isRequired' => false,
2033
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
2034
                ]
2035
            ),
2036
        ];
2037
2038
        $this->assertForCreateContentContentValidationException(
2039
            $mainLanguageCode,
2040
            $structFields,
2041
            $fieldDefinitions
2042
        );
2043
    }
2044
2045
    /**
2046
     * Asserts behaviour necessary for testing ContentFieldValidationException because of required
@@ 4825-4845 (lines=21) @@
4822
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentValidationException
4823
     * @expectedExceptionMessage A value is set for non translatable field definition 'identifier' with language 'eng-US'
4824
     */
4825
    public function testUpdateContentThrowsContentValidationExceptionTranslation($initialLanguageCode, $structFields)
4826
    {
4827
        $fieldDefinitions = [
4828
            new FieldDefinition(
4829
                [
4830
                    'id' => 'fieldDefinitionId1',
4831
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
4832
                    'isTranslatable' => false,
4833
                    'identifier' => 'identifier',
4834
                    'isRequired' => false,
4835
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
4836
                ]
4837
            ),
4838
        ];
4839
4840
        $this->assertForUpdateContentContentValidationException(
4841
            $initialLanguageCode,
4842
            $structFields,
4843
            $fieldDefinitions
4844
        );
4845
    }
4846
4847
    public function assertForTestUpdateContentRequiredField(
4848
        $initialLanguageCode,