Code Duplication    Length = 21-22 lines in 3 locations

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

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