Code Duplication    Length = 36-38 lines in 3 locations

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

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