Code Duplication    Length = 21-21 lines in 4 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/FieldValue/Converter/DateTest.php 2 locations

@@ 92-112 (lines=21) @@
89
    /**
90
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\DateConverter::toStorageFieldDefinition
91
     */
92
    public function testToStorageFieldDefinitionDefaultEmpty()
93
    {
94
        $storageFieldDef = new StorageFieldDefinition();
95
        $fieldTypeConstraints = new FieldTypeConstraints();
96
        $fieldTypeConstraints->fieldSettings = new FieldSettings(
97
            array(
98
                'defaultType' => DateType::DEFAULT_EMPTY,
99
            )
100
        );
101
        $fieldDef = new PersistenceFieldDefinition(
102
            array(
103
                'fieldTypeConstraints' => $fieldTypeConstraints,
104
            )
105
        );
106
107
        $this->converter->toStorageFieldDefinition($fieldDef, $storageFieldDef);
108
        self::assertSame(
109
            DateType::DEFAULT_EMPTY,
110
            $storageFieldDef->dataInt1
111
        );
112
    }
113
114
    /**
115
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\DateConverter::toStorageFieldDefinition
@@ 117-137 (lines=21) @@
114
    /**
115
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\DateConverter::toStorageFieldDefinition
116
     */
117
    public function testToStorageFieldDefinitionDefaultCurrentDate()
118
    {
119
        $storageFieldDef = new StorageFieldDefinition();
120
        $fieldTypeConstraints = new FieldTypeConstraints();
121
        $fieldTypeConstraints->fieldSettings = new FieldSettings(
122
            array(
123
                'defaultType' => DateType::DEFAULT_CURRENT_DATE,
124
            )
125
        );
126
        $fieldDef = new PersistenceFieldDefinition(
127
            array(
128
                'fieldTypeConstraints' => $fieldTypeConstraints,
129
            )
130
        );
131
132
        $this->converter->toStorageFieldDefinition($fieldDef, $storageFieldDef);
133
        self::assertSame(
134
            DateType::DEFAULT_CURRENT_DATE,
135
            $storageFieldDef->dataInt1
136
        );
137
    }
138
139
    /**
140
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\DateConverter::toFieldDefinition

eZ/Publish/Core/Persistence/Legacy/Tests/Content/FieldValue/Converter/AuthorTest.php 2 locations

@@ 134-154 (lines=21) @@
131
    /**
132
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\AuthorConverter::toStorageFieldDefinition
133
     */
134
    public function testToStorageFieldDefinitionDefaultCurrentUser()
135
    {
136
        $storageFieldDef = new StorageFieldDefinition();
137
        $fieldTypeConstraints = new FieldTypeConstraints();
138
        $fieldTypeConstraints->fieldSettings = new FieldSettings(
139
            array(
140
                'defaultAuthor' => AuthorType::DEFAULT_CURRENT_USER,
141
            )
142
        );
143
        $fieldDef = new SPIFieldDefinition(
144
            array(
145
                'fieldTypeConstraints' => $fieldTypeConstraints,
146
            )
147
        );
148
149
        $this->converter->toStorageFieldDefinition($fieldDef, $storageFieldDef);
150
        self::assertSame(
151
            AuthorType::DEFAULT_CURRENT_USER,
152
            $storageFieldDef->dataInt1
153
        );
154
    }
155
156
    /**
157
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\AuthorConverter::toStorageFieldDefinition
@@ 159-179 (lines=21) @@
156
    /**
157
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\AuthorConverter::toStorageFieldDefinition
158
     */
159
    public function testToStorageFieldDefinitionDefaultEmpty()
160
    {
161
        $storageFieldDef = new StorageFieldDefinition();
162
        $fieldTypeConstraints = new FieldTypeConstraints();
163
        $fieldTypeConstraints->fieldSettings = new FieldSettings(
164
            array(
165
                'defaultAuthor' => AuthorType::DEFAULT_EMPTY,
166
            )
167
        );
168
        $fieldDef = new SPIFieldDefinition(
169
            array(
170
                'fieldTypeConstraints' => $fieldTypeConstraints,
171
            )
172
        );
173
174
        $this->converter->toStorageFieldDefinition($fieldDef, $storageFieldDef);
175
        self::assertSame(
176
            AuthorType::DEFAULT_EMPTY,
177
            $storageFieldDef->dataInt1
178
        );
179
    }
180
}
181