Code Duplication    Length = 21-22 lines in 3 locations

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

@@ 1415-1436 (lines=22) @@
1412
     * @covers \eZ\Publish\Core\Repository\ContentService::createContent
1413
     * @dataProvider providerForTestCreateContentNonRedundantFieldSet1
1414
     */
1415
    public function testCreateContentNonRedundantFieldSet1($mainLanguageCode, $structFields, $spiFields)
1416
    {
1417
        $fieldDefinitions = array(
1418
            new FieldDefinition(
1419
                array(
1420
                    'id' => 'fieldDefinitionId',
1421
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
1422
                    'isTranslatable' => false,
1423
                    'identifier' => 'identifier',
1424
                    'isRequired' => false,
1425
                    'defaultValue' => 'defaultValue',
1426
                )
1427
            ),
1428
        );
1429
1430
        $this->assertForTestCreateContentNonRedundantFieldSet(
1431
            $mainLanguageCode,
1432
            $structFields,
1433
            $spiFields,
1434
            $fieldDefinitions
1435
        );
1436
    }
1437
1438
    public function providerForTestCreateContentNonRedundantFieldSet2()
1439
    {
@@ 1981-2001 (lines=21) @@
1978
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentValidationException
1979
     * @expectedExceptionMessage A value is set for non translatable field definition 'identifier' with language 'eng-US'
1980
     */
1981
    public function testCreateContentThrowsContentValidationExceptionTranslation($mainLanguageCode, $structFields)
1982
    {
1983
        $fieldDefinitions = array(
1984
            new FieldDefinition(
1985
                array(
1986
                    'id' => 'fieldDefinitionId1',
1987
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
1988
                    'isTranslatable' => false,
1989
                    'identifier' => 'identifier',
1990
                    'isRequired' => false,
1991
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
1992
                )
1993
            ),
1994
        );
1995
1996
        $this->assertForCreateContentContentValidationException(
1997
            $mainLanguageCode,
1998
            $structFields,
1999
            $fieldDefinitions
2000
        );
2001
    }
2002
2003
    /**
2004
     * Asserts behaviour necessary for testing ContentValidationException because of required
@@ 4776-4796 (lines=21) @@
4773
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentValidationException
4774
     * @expectedExceptionMessage A value is set for non translatable field definition 'identifier' with language 'eng-US'
4775
     */
4776
    public function testUpdateContentThrowsContentValidationExceptionTranslation($initialLanguageCode, $structFields)
4777
    {
4778
        $fieldDefinitions = array(
4779
            new FieldDefinition(
4780
                array(
4781
                    'id' => 'fieldDefinitionId1',
4782
                    'fieldTypeIdentifier' => 'fieldTypeIdentifier',
4783
                    'isTranslatable' => false,
4784
                    'identifier' => 'identifier',
4785
                    'isRequired' => false,
4786
                    'defaultValue' => self::EMPTY_FIELD_VALUE,
4787
                )
4788
            ),
4789
        );
4790
4791
        $this->assertForUpdateContentContentValidationException(
4792
            $initialLanguageCode,
4793
            $structFields,
4794
            $fieldDefinitions
4795
        );
4796
    }
4797
4798
    public function assertForTestUpdateContentThrowsContentValidationExceptionRequiredField(
4799
        $initialLanguageCode,