Code Duplication    Length = 36-38 lines in 3 locations

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

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