Code Duplication    Length = 32-32 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/FieldValue/Converter/RelationListTest.php 1 location

@@ 200-231 (lines=32) @@
197
     * @group fieldType
198
     * @group relationlist
199
     */
200
    public function testToStorageFieldDefinition()
201
    {
202
        $fieldDefinition = new PersistenceFieldDefinition(
203
            array(
204
                'fieldTypeConstraints' => new FieldTypeConstraints(
205
                    array(
206
                        'fieldSettings' => array(
207
                            'selectionMethod' => Type::SELECTION_BROWSE,
208
                            'selectionDefaultLocation' => 12345,
209
                            'selectionContentTypes' => array('article', 'blog_post'),
210
                        ),
211
                    )
212
                ),
213
            )
214
        );
215
216
        $expectedStorageFieldDefinition = new StorageFieldDefinition();
217
        $expectedStorageFieldDefinition->dataText5 = <<<EOT
218
<?xml version="1.0" encoding="utf-8"?>
219
<related-objects><constraints><allowed-class contentclass-identifier="article"/><allowed-class contentclass-identifier="blog_post"/></constraints><type value="2"/><object_class value=""/><selection_type value="0"/><contentobject-placement node-id="12345"/></related-objects>
220
221
EOT;
222
223
        $actualStorageFieldDefinition = new StorageFieldDefinition();
224
225
        $this->converter->toStorageFieldDefinition($fieldDefinition, $actualStorageFieldDefinition);
226
227
        $this->assertEquals(
228
            $expectedStorageFieldDefinition,
229
            $actualStorageFieldDefinition
230
        );
231
    }
232
233
    /**
234
     * @group fieldType

eZ/Publish/Core/Persistence/Legacy/Tests/Content/FieldValue/Converter/RelationTest.php 1 location

@@ 38-69 (lines=32) @@
35
     * @group fieldType
36
     * @group relationlist
37
     */
38
    public function testToStorageFieldDefinition()
39
    {
40
        $fieldDefinition = new PersistenceFieldDefinition(
41
            [
42
                'fieldTypeConstraints' => new FieldTypeConstraints(
43
                    [
44
                        'fieldSettings' => [
45
                            'selectionMethod' => Type::SELECTION_BROWSE,
46
                            'selectionRoot' => 12345,
47
                            'selectionContentTypes' => ['article', 'blog_post'],
48
                        ],
49
                    ]
50
                ),
51
            ]
52
        );
53
54
        $expectedStorageFieldDefinition = new StorageFieldDefinition();
55
        $expectedStorageFieldDefinition->dataText5 = <<<EOT
56
<?xml version="1.0" encoding="utf-8"?>
57
<related-objects><constraints><allowed-class contentclass-identifier="article"/><allowed-class contentclass-identifier="blog_post"/></constraints><selection_type value="0"/><contentobject-placement node-id="12345"/></related-objects>
58
59
EOT;
60
61
        $actualStorageFieldDefinition = new StorageFieldDefinition();
62
63
        $this->converter->toStorageFieldDefinition($fieldDefinition, $actualStorageFieldDefinition);
64
65
        $this->assertEquals(
66
            $expectedStorageFieldDefinition,
67
            $actualStorageFieldDefinition
68
        );
69
    }
70
}
71