Code Duplication    Length = 36-38 lines in 3 locations

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

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