Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 2015-2038 (lines=24) @@
2012
     * @covers \eZ\Publish\Core\Repository\ContentService::createContent
2013
     * @dataProvider providerForTestCreateContentThrowsContentValidationExceptionTranslation
2014
     */
2015
    public function testCreateContentThrowsContentValidationExceptionTranslation($mainLanguageCode, $structFields)
2016
    {
2017
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentValidationException::class);
2018
        $this->expectExceptionMessage('You cannot set a value for the non-translatable Field definition \'identifier\' in language \'eng-US\'');
2019
2020
        $fieldDefinitions = [
2021
            new FieldDefinition(
2022
                [
2023
                    'id' => 'fieldDefinitionId1',
2024
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
2025
                    'isTranslatable' => false,
2026
                    'identifier' => 'identifier',
2027
                    'isRequired' => false,
2028
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
2029
                ]
2030
            ),
2031
        ];
2032
2033
        $this->assertForCreateContentContentValidationException(
2034
            $mainLanguageCode,
2035
            $structFields,
2036
            $fieldDefinitions
2037
        );
2038
    }
2039
2040
    /**
2041
     * Asserts behaviour necessary for testing ContentFieldValidationException because of required
@@ 4851-4874 (lines=24) @@
4848
     * @covers \eZ\Publish\Core\Repository\ContentService::updateContent
4849
     * @dataProvider providerForTestUpdateContentThrowsContentValidationExceptionTranslation
4850
     */
4851
    public function testUpdateContentThrowsContentValidationExceptionTranslation($initialLanguageCode, $structFields)
4852
    {
4853
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentValidationException::class);
4854
        $this->expectExceptionMessage('You cannot set a value for the non-translatable Field definition \'identifier\' in language \'eng-US\'');
4855
4856
        $fieldDefinitions = [
4857
            new FieldDefinition(
4858
                [
4859
                    'id' => 'fieldDefinitionId1',
4860
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
4861
                    'isTranslatable' => false,
4862
                    'identifier' => 'identifier',
4863
                    'isRequired' => false,
4864
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
4865
                ]
4866
            ),
4867
        ];
4868
4869
        $this->assertForUpdateContentContentValidationException(
4870
            $initialLanguageCode,
4871
            $structFields,
4872
            $fieldDefinitions
4873
        );
4874
    }
4875
4876
    public function assertForTestUpdateContentRequiredField(
4877
        $initialLanguageCode,