Code Duplication    Length = 19-19 lines in 8 locations

tests/NestedIntervalsBehavior64TestCase.php 6 locations

@@ 220-238 (lines=19) @@
217
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
218
    }
219
220
    public function testPrependToInsertInEmptyAmount77NoPrepend()
221
    {
222
        $config = [
223
            'amountOptimize' => 77,
224
            'noPrepend'      => true,
225
        ];
226
227
        $node = new MultipleTreeNode64(['slug' => 'new1']);
228
        Yii::configure($node->getBehavior('tree'), $config);
229
        $this->assertTrue($node->prependTo(MultipleTreeNode64::findOne(16))->save());
230
231
        $node = new MultipleTreeNode64(['slug' => 'new2']);
232
        Yii::configure($node->getBehavior('tree'), $config);
233
        $this->assertTrue($node->prependTo(MultipleTreeNode64::findOne(18))->save());
234
235
        $dataSet = $this->getConnection()->createDataSet(['multiple_tree_64']);
236
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-prepend-to-insert-in-empty-amount-77-no-prepend-64.php'));
237
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
238
    }
239
240
    public function testPrependToInsertInEmptyAmount4NoAppend()
241
    {
@@ 240-258 (lines=19) @@
237
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
238
    }
239
240
    public function testPrependToInsertInEmptyAmount4NoAppend()
241
    {
242
        $config = [
243
            'amountOptimize' => 4,
244
            'noAppend'       => true,
245
        ];
246
247
        $node = new MultipleTreeNode64(['slug' => 'new1']);
248
        Yii::configure($node->getBehavior('tree'), $config);
249
        $this->assertTrue($node->prependTo(MultipleTreeNode64::findOne(16))->save());
250
251
        $node = new MultipleTreeNode64(['slug' => 'new2']);
252
        Yii::configure($node->getBehavior('tree'), $config);
253
        $this->assertTrue($node->prependTo(MultipleTreeNode64::findOne(18))->save());
254
255
        $dataSet = $this->getConnection()->createDataSet(['multiple_tree_64']);
256
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-prepend-to-insert-in-empty-amount-4-no-append-64.php'));
257
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
258
    }
259
260
    public function testPrependToInsertInEmptyAmount7NoInsert()
261
    {
@@ 260-278 (lines=19) @@
257
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
258
    }
259
260
    public function testPrependToInsertInEmptyAmount7NoInsert()
261
    {
262
        $config = [
263
            'amountOptimize' => 7,
264
            'noInsert'       => true,
265
        ];
266
267
        $node = new MultipleTreeNode64(['slug' => 'new1']);
268
        Yii::configure($node->getBehavior('tree'), $config);
269
        $this->assertTrue($node->prependTo(MultipleTreeNode64::findOne(16))->save());
270
271
        $node = new MultipleTreeNode64(['slug' => 'new2']);
272
        Yii::configure($node->getBehavior('tree'), $config);
273
        $this->assertTrue($node->prependTo(MultipleTreeNode64::findOne(18))->save());
274
275
        $dataSet = $this->getConnection()->createDataSet(['multiple_tree_64']);
276
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-prepend-to-insert-in-empty-amount-7-no-insert-64.php'));
277
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
278
    }
279
280
    public function testPrependToInsertInEmptyAmount13Reserve3()
281
    {
@@ 342-360 (lines=19) @@
339
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
340
    }
341
342
    public function testAppendToInsertInEmptyAmount77NoPrepend()
343
    {
344
        $config = [
345
            'amountOptimize' => 77,
346
            'noPrepend'      => true,
347
        ];
348
349
        $node = new MultipleTreeNode64(['slug' => 'new1']);
350
        Yii::configure($node->getBehavior('tree'), $config);
351
        $this->assertTrue($node->appendTo(MultipleTreeNode64::findOne(16))->save());
352
353
        $node = new MultipleTreeNode64(['slug' => 'new2']);
354
        Yii::configure($node->getBehavior('tree'), $config);
355
        $this->assertTrue($node->appendTo(MultipleTreeNode64::findOne(18))->save());
356
357
        $dataSet = $this->getConnection()->createDataSet(['multiple_tree_64']);
358
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-append-to-insert-in-empty-amount-77-no-prepend-64.php'));
359
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
360
    }
361
362
    public function testAppendToInsertInEmptyAmount4NoAppend()
363
    {
@@ 362-380 (lines=19) @@
359
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
360
    }
361
362
    public function testAppendToInsertInEmptyAmount4NoAppend()
363
    {
364
        $config = [
365
            'amountOptimize' => 4,
366
            'noAppend'       => true,
367
        ];
368
369
        $node = new MultipleTreeNode64(['slug' => 'new1']);
370
        Yii::configure($node->getBehavior('tree'), $config);
371
        $this->assertTrue($node->appendTo(MultipleTreeNode64::findOne(16))->save());
372
373
        $node = new MultipleTreeNode64(['slug' => 'new2']);
374
        Yii::configure($node->getBehavior('tree'), $config);
375
        $this->assertTrue($node->appendTo(MultipleTreeNode64::findOne(18))->save());
376
377
        $dataSet = $this->getConnection()->createDataSet(['multiple_tree_64']);
378
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-append-to-insert-in-empty-amount-4-no-append-64.php'));
379
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
380
    }
381
382
    public function testAppendToInsertInEmptyAmount7NoInsert()
383
    {
@@ 382-400 (lines=19) @@
379
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
380
    }
381
382
    public function testAppendToInsertInEmptyAmount7NoInsert()
383
    {
384
        $config = [
385
            'amountOptimize' => 7,
386
            'noInsert'       => true,
387
        ];
388
389
        $node = new MultipleTreeNode64(['slug' => 'new1']);
390
        Yii::configure($node->getBehavior('tree'), $config);
391
        $this->assertTrue($node->appendTo(MultipleTreeNode64::findOne(16))->save());
392
393
        $node = new MultipleTreeNode64(['slug' => 'new2']);
394
        Yii::configure($node->getBehavior('tree'), $config);
395
        $this->assertTrue($node->appendTo(MultipleTreeNode64::findOne(18))->save());
396
397
        $dataSet = $this->getConnection()->createDataSet(['multiple_tree_64']);
398
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-append-to-insert-in-empty-amount-7-no-insert-64.php'));
399
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
400
    }
401
402
    public function testAppendToInsertInEmptyAmount13Reserve3()
403
    {

tests/NestedIntervalsBehaviorTestCase.php 2 locations

@@ 353-371 (lines=19) @@
350
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
351
    }
352
353
    public function testPrependToInsertInEmptyAmount13Reserve3()
354
    {
355
        $config = [
356
            'amountOptimize' => 13,
357
            'reserveFactor'  => 3,
358
        ];
359
360
        $node = new Node(['slug' => 'new']);
361
        Yii::configure($node->getBehavior('tree'), $config);
362
        $this->assertTrue($node->prependTo(Node::findOne(6))->save());
363
364
        $node = new MultipleTreeNode(['slug' => 'new']);
365
        Yii::configure($node->getBehavior('tree'), $config);
366
        $this->assertTrue($node->prependTo(MultipleTreeNode::findOne(6))->save());
367
368
        $dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']);
369
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-prepend-to-insert-in-empty-amount-13-reserve-3.php'));
370
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
371
    }
372
373
    public function testPrependToUpdateSameNode()
374
    {
@@ 596-614 (lines=19) @@
593
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
594
    }
595
596
    public function testAppendToInsertInEmptyAmount13Reserve3()
597
    {
598
        $config = [
599
            'amountOptimize' => 13,
600
            'reserveFactor'  => 3,
601
        ];
602
603
        $node = new Node(['slug' => 'new']);
604
        Yii::configure($node->getBehavior('tree'), $config);
605
        $this->assertTrue($node->appendTo(Node::findOne(6))->save());
606
607
        $node = new MultipleTreeNode(['slug' => 'new']);
608
        Yii::configure($node->getBehavior('tree'), $config);
609
        $this->assertTrue($node->appendTo(MultipleTreeNode::findOne(6))->save());
610
611
        $dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']);
612
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-append-to-insert-in-empty-amount-13-reserve-3.php'));
613
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
614
    }
615
616
    public function testAppendToUpdateSameNode()
617
    {