Code Duplication    Length = 36-38 lines in 3 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/Location/Gateway/DoctrineDatabaseTest.php 3 locations

@@ 150-185 (lines=36) @@
147
        $this->assertCount(0, $locationsData);
148
    }
149
150
    public function testMoveSubtreePathUpdate()
151
    {
152
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php');
153
        $handler = $this->getLocationGateway();
154
        $handler->moveSubtreeNodes(
155
            array(
156
                'path_string' => '/1/2/69/',
157
                'path_identification_string' => 'products',
158
                'is_hidden' => 0,
159
                'is_invisible' => 0,
160
            ),
161
            array(
162
                'path_string' => '/1/2/77/',
163
                'path_identification_string' => 'solutions',
164
                'is_hidden' => 0,
165
                'is_invisible' => 0,
166
            )
167
        );
168
169
        /** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
170
        $query = $this->handler->createSelectQuery();
171
        $this->assertQueryResult(
172
            array(
173
                array(65, '/1/2/', '', 1, 1, 0, 0),
174
                array(67, '/1/2/77/69/', 'solutions/products', 77, 3, 0, 0),
175
                array(69, '/1/2/77/69/70/71/', 'solutions/products/software/os_type_i', 70, 5, 0, 0),
176
                array(73, '/1/2/77/69/72/75/', 'solutions/products/boxes/cd_dvd_box_iii', 72, 5, 0, 0),
177
                array(75, '/1/2/77/', 'solutions', 2, 2, 0, 0),
178
            ),
179
            $query
180
                ->select('contentobject_id', 'path_string', 'path_identification_string', 'parent_node_id', 'depth', 'is_hidden', 'is_invisible')
181
                ->from('ezcontentobject_tree')
182
                ->where($query->expr->in('node_id', array(69, 71, 75, 77, 2)))
183
                ->orderBy('contentobject_id')
184
        );
185
    }
186
187
    public function testMoveHiddenDestinationUpdate()
188
    {
@@ 187-224 (lines=38) @@
184
        );
185
    }
186
187
    public function testMoveHiddenDestinationUpdate()
188
    {
189
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php');
190
        $handler = $this->getLocationGateway();
191
        $handler->hideSubtree('/1/2/77/');
192
        $handler->moveSubtreeNodes(
193
            array(
194
                'path_string' => '/1/2/69/',
195
                'path_identification_string' => 'products',
196
                'is_hidden' => 0,
197
                'is_invisible' => 0,
198
            ),
199
            array(
200
                'path_string' => '/1/2/77/',
201
                'path_identification_string' => 'solutions',
202
                'is_hidden' => 1,
203
                'is_invisible' => 1,
204
205
            )
206
        );
207
208
        /** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
209
        $query = $this->handler->createSelectQuery();
210
        $this->assertQueryResult(
211
            array(
212
                array(65, '/1/2/', '', 1, 1, 0, 0),
213
                array(67, '/1/2/77/69/', 'solutions/products', 77, 3, 0, 1),
214
                array(69, '/1/2/77/69/70/71/', 'solutions/products/software/os_type_i', 70, 5, 0, 1),
215
                array(73, '/1/2/77/69/72/75/', 'solutions/products/boxes/cd_dvd_box_iii', 72, 5, 0, 1),
216
                array(75, '/1/2/77/', 'solutions', 2, 2, 1, 1),
217
            ),
218
            $query
219
                ->select('contentobject_id', 'path_string', 'path_identification_string', 'parent_node_id', 'depth', 'is_hidden', 'is_invisible')
220
                ->from('ezcontentobject_tree')
221
                ->where($query->expr->in('node_id', array(69, 71, 75, 77, 2)))
222
                ->orderBy('contentobject_id')
223
        );
224
    }
225
226
    public function testMoveHiddenSourceUpdate()
227
    {
@@ 226-263 (lines=38) @@
223
        );
224
    }
225
226
    public function testMoveHiddenSourceUpdate()
227
    {
228
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php');
229
        $handler = $this->getLocationGateway();
230
        $handler->hideSubtree('/1/2/69/');
231
        $handler->moveSubtreeNodes(
232
            array(
233
                'path_string' => '/1/2/69/',
234
                'path_identification_string' => 'products',
235
                'is_hidden' => 1,
236
                'is_invisible' => 1,
237
            ),
238
            array(
239
                'path_string' => '/1/2/77/',
240
                'path_identification_string' => 'solutions',
241
                'is_hidden' => 0,
242
                'is_invisible' => 0,
243
244
            )
245
        );
246
247
        /** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
248
        $query = $this->handler->createSelectQuery();
249
        $this->assertQueryResult(
250
            array(
251
                array(65, '/1/2/', '', 1, 1, 0, 0),
252
                array(67, '/1/2/77/69/', 'solutions/products', 77, 3, 1, 1),
253
                array(69, '/1/2/77/69/70/71/', 'solutions/products/software/os_type_i', 70, 5, 0, 1),
254
                array(73, '/1/2/77/69/72/75/', 'solutions/products/boxes/cd_dvd_box_iii', 72, 5, 0, 1),
255
                array(75, '/1/2/77/', 'solutions', 2, 2, 0, 0),
256
            ),
257
            $query
258
                ->select('contentobject_id', 'path_string', 'path_identification_string', 'parent_node_id', 'depth', 'is_hidden', 'is_invisible')
259
                ->from('ezcontentobject_tree')
260
                ->where($query->expr->in('node_id', array(69, 71, 75, 77, 2)))
261
                ->orderBy('contentobject_id')
262
        );
263
    }
264
265
    public function testMoveHiddenSourceChildUpdate()
266
    {