Code Duplication    Length = 36-38 lines in 3 locations

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

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