Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 2003-2026 (lines=24) @@
2000
     * @covers \eZ\Publish\Core\Repository\ContentService::createContent
2001
     * @dataProvider providerForTestCreateContentThrowsContentValidationExceptionTranslation
2002
     */
2003
    public function testCreateContentThrowsContentValidationExceptionTranslation($mainLanguageCode, $structFields)
2004
    {
2005
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentValidationException::class);
2006
        $this->expectExceptionMessage('A value is set for non translatable field definition \'identifier\' with language \'eng-US\'');
2007
2008
        $fieldDefinitions = [
2009
            new FieldDefinition(
2010
                [
2011
                    'id' => 'fieldDefinitionId1',
2012
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
2013
                    'isTranslatable' => false,
2014
                    'identifier' => 'identifier',
2015
                    'isRequired' => false,
2016
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
2017
                ]
2018
            ),
2019
        ];
2020
2021
        $this->assertForCreateContentContentValidationException(
2022
            $mainLanguageCode,
2023
            $structFields,
2024
            $fieldDefinitions
2025
        );
2026
    }
2027
2028
    /**
2029
     * Asserts behaviour necessary for testing ContentFieldValidationException because of required
@@ 4818-4841 (lines=24) @@
4815
     * @covers \eZ\Publish\Core\Repository\ContentService::updateContent
4816
     * @dataProvider providerForTestUpdateContentThrowsContentValidationExceptionTranslation
4817
     */
4818
    public function testUpdateContentThrowsContentValidationExceptionTranslation($initialLanguageCode, $structFields)
4819
    {
4820
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentValidationException::class);
4821
        $this->expectExceptionMessage('A value is set for non translatable field definition \'identifier\' with language \'eng-US\'');
4822
4823
        $fieldDefinitions = [
4824
            new FieldDefinition(
4825
                [
4826
                    'id' => 'fieldDefinitionId1',
4827
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
4828
                    'isTranslatable' => false,
4829
                    'identifier' => 'identifier',
4830
                    'isRequired' => false,
4831
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
4832
                ]
4833
            ),
4834
        ];
4835
4836
        $this->assertForUpdateContentContentValidationException(
4837
            $initialLanguageCode,
4838
            $structFields,
4839
            $fieldDefinitions
4840
        );
4841
    }
4842
4843
    public function assertForTestUpdateContentRequiredField(
4844
        $initialLanguageCode,