Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 1993-2016 (lines=24) @@
1990
     * @covers \eZ\Publish\Core\Repository\ContentService::createContent
1991
     * @dataProvider providerForTestCreateContentThrowsContentValidationExceptionTranslation
1992
     */
1993
    public function testCreateContentThrowsContentValidationExceptionTranslation($mainLanguageCode, $structFields)
1994
    {
1995
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentValidationException::class);
1996
        $this->expectExceptionMessage('A value is set for non translatable field definition \'identifier\' with language \'eng-US\'');
1997
1998
        $fieldDefinitions = array(
1999
            new FieldDefinition(
2000
                array(
2001
                    'id' => 'fieldDefinitionId1',
2002
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
2003
                    'isTranslatable' => false,
2004
                    'identifier' => 'identifier',
2005
                    'isRequired' => false,
2006
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
2007
                )
2008
            ),
2009
        );
2010
2011
        $this->assertForCreateContentContentValidationException(
2012
            $mainLanguageCode,
2013
            $structFields,
2014
            $fieldDefinitions
2015
        );
2016
    }
2017
2018
    /**
2019
     * Asserts behaviour necessary for testing ContentFieldValidationException because of required
@@ 4804-4827 (lines=24) @@
4801
     * @covers \eZ\Publish\Core\Repository\ContentService::updateContent
4802
     * @dataProvider providerForTestUpdateContentThrowsContentValidationExceptionTranslation
4803
     */
4804
    public function testUpdateContentThrowsContentValidationExceptionTranslation($initialLanguageCode, $structFields)
4805
    {
4806
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\ContentValidationException::class);
4807
        $this->expectExceptionMessage('A value is set for non translatable field definition \'identifier\' with language \'eng-US\'');
4808
4809
        $fieldDefinitions = array(
4810
            new FieldDefinition(
4811
                array(
4812
                    'id' => 'fieldDefinitionId1',
4813
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
4814
                    'isTranslatable' => false,
4815
                    'identifier' => 'identifier',
4816
                    'isRequired' => false,
4817
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
4818
                )
4819
            ),
4820
        );
4821
4822
        $this->assertForUpdateContentContentValidationException(
4823
            $initialLanguageCode,
4824
            $structFields,
4825
            $fieldDefinitions
4826
        );
4827
    }
4828
4829
    public function assertForTestUpdateContentRequiredField(
4830
        $initialLanguageCode,