Code Duplication    Length = 27-27 lines in 6 locations

tests/NestedIntervalsBehaviorTestCase.php 6 locations

@@ 269-295 (lines=27) @@
266
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
267
    }
268
269
    public function testPrependToInsertInEmptyAmount77NoPrepend()
270
    {
271
        $config = [
272
            'amountOptimize' => 77,
273
            'noPrepend'      => true,
274
        ];
275
276
        $node = new Node(['slug' => 'new1']);
277
        Yii::configure($node->getBehavior('tree'), $config);
278
        $this->assertTrue($node->prependTo(Node::findOne(14))->save());
279
280
        $node = new Node(['slug' => 'new2']);
281
        Yii::configure($node->getBehavior('tree'), $config);
282
        $this->assertTrue($node->prependTo(Node::findOne(15))->save());
283
284
        $node = new MultipleTreeNode(['slug' => 'new1']);
285
        Yii::configure($node->getBehavior('tree'), $config);
286
        $this->assertTrue($node->prependTo(MultipleTreeNode::findOne(16))->save());
287
288
        $node = new MultipleTreeNode(['slug' => 'new2']);
289
        Yii::configure($node->getBehavior('tree'), $config);
290
        $this->assertTrue($node->prependTo(MultipleTreeNode::findOne(18))->save());
291
292
        $dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']);
293
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-prepend-to-insert-in-empty-amount-77-no-prepend.php'));
294
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
295
    }
296
297
    public function testPrependToInsertInEmptyAmount4NoAppend()
298
    {
@@ 297-323 (lines=27) @@
294
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
295
    }
296
297
    public function testPrependToInsertInEmptyAmount4NoAppend()
298
    {
299
        $config = [
300
            'amountOptimize' => 4,
301
            'noAppend'       => true,
302
        ];
303
304
        $node = new Node(['slug' => 'new1']);
305
        Yii::configure($node->getBehavior('tree'), $config);
306
        $this->assertTrue($node->prependTo(Node::findOne(14))->save());
307
308
        $node = new Node(['slug' => 'new2']);
309
        Yii::configure($node->getBehavior('tree'), $config);
310
        $this->assertTrue($node->prependTo(Node::findOne(15))->save());
311
312
        $node = new MultipleTreeNode(['slug' => 'new1']);
313
        Yii::configure($node->getBehavior('tree'), $config);
314
        $this->assertTrue($node->prependTo(MultipleTreeNode::findOne(16))->save());
315
316
        $node = new MultipleTreeNode(['slug' => 'new2']);
317
        Yii::configure($node->getBehavior('tree'), $config);
318
        $this->assertTrue($node->prependTo(MultipleTreeNode::findOne(18))->save());
319
320
        $dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']);
321
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-prepend-to-insert-in-empty-amount-4-no-append.php'));
322
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
323
    }
324
325
    public function testPrependToInsertInEmptyAmount7NoInsert()
326
    {
@@ 325-351 (lines=27) @@
322
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
323
    }
324
325
    public function testPrependToInsertInEmptyAmount7NoInsert()
326
    {
327
        $config = [
328
            'amountOptimize' => 7,
329
            'noInsert'       => true,
330
        ];
331
332
        $node = new Node(['slug' => 'new1']);
333
        Yii::configure($node->getBehavior('tree'), $config);
334
        $this->assertTrue($node->prependTo(Node::findOne(14))->save());
335
336
        $node = new Node(['slug' => 'new2']);
337
        Yii::configure($node->getBehavior('tree'), $config);
338
        $this->assertTrue($node->prependTo(Node::findOne(15))->save());
339
340
        $node = new MultipleTreeNode(['slug' => 'new1']);
341
        Yii::configure($node->getBehavior('tree'), $config);
342
        $this->assertTrue($node->prependTo(MultipleTreeNode::findOne(16))->save());
343
344
        $node = new MultipleTreeNode(['slug' => 'new2']);
345
        Yii::configure($node->getBehavior('tree'), $config);
346
        $this->assertTrue($node->prependTo(MultipleTreeNode::findOne(18))->save());
347
348
        $dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']);
349
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-prepend-to-insert-in-empty-amount-7-no-insert.php'));
350
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
351
    }
352
353
    public function testPrependToInsertInEmptyAmount13Reserve3()
354
    {
@@ 512-538 (lines=27) @@
509
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
510
    }
511
512
    public function testAppendToInsertInEmptyAmount77NoPrepend()
513
    {
514
        $config = [
515
            'amountOptimize' => 77,
516
            'noPrepend'      => true,
517
        ];
518
519
        $node = new Node(['slug' => 'new1']);
520
        Yii::configure($node->getBehavior('tree'), $config);
521
        $this->assertTrue($node->appendTo(Node::findOne(14))->save());
522
523
        $node = new Node(['slug' => 'new2']);
524
        Yii::configure($node->getBehavior('tree'), $config);
525
        $this->assertTrue($node->appendTo(Node::findOne(15))->save());
526
527
        $node = new MultipleTreeNode(['slug' => 'new1']);
528
        Yii::configure($node->getBehavior('tree'), $config);
529
        $this->assertTrue($node->appendTo(MultipleTreeNode::findOne(16))->save());
530
531
        $node = new MultipleTreeNode(['slug' => 'new2']);
532
        Yii::configure($node->getBehavior('tree'), $config);
533
        $this->assertTrue($node->appendTo(MultipleTreeNode::findOne(18))->save());
534
535
        $dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']);
536
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-append-to-insert-in-empty-amount-77-no-prepend.php'));
537
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
538
    }
539
540
    public function testAppendToInsertInEmptyAmount4NoAppend()
541
    {
@@ 540-566 (lines=27) @@
537
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
538
    }
539
540
    public function testAppendToInsertInEmptyAmount4NoAppend()
541
    {
542
        $config = [
543
            'amountOptimize' => 4,
544
            'noAppend'       => true,
545
        ];
546
547
        $node = new Node(['slug' => 'new1']);
548
        Yii::configure($node->getBehavior('tree'), $config);
549
        $this->assertTrue($node->appendTo(Node::findOne(14))->save());
550
551
        $node = new Node(['slug' => 'new2']);
552
        Yii::configure($node->getBehavior('tree'), $config);
553
        $this->assertTrue($node->appendTo(Node::findOne(15))->save());
554
555
        $node = new MultipleTreeNode(['slug' => 'new1']);
556
        Yii::configure($node->getBehavior('tree'), $config);
557
        $this->assertTrue($node->appendTo(MultipleTreeNode::findOne(16))->save());
558
559
        $node = new MultipleTreeNode(['slug' => 'new2']);
560
        Yii::configure($node->getBehavior('tree'), $config);
561
        $this->assertTrue($node->appendTo(MultipleTreeNode::findOne(18))->save());
562
563
        $dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']);
564
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-append-to-insert-in-empty-amount-4-no-append.php'));
565
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
566
    }
567
568
    public function testAppendToInsertInEmptyAmount7NoInsert()
569
    {
@@ 568-594 (lines=27) @@
565
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
566
    }
567
568
    public function testAppendToInsertInEmptyAmount7NoInsert()
569
    {
570
        $config = [
571
            'amountOptimize' => 7,
572
            'noInsert'       => true,
573
        ];
574
575
        $node = new Node(['slug' => 'new1']);
576
        Yii::configure($node->getBehavior('tree'), $config);
577
        $this->assertTrue($node->appendTo(Node::findOne(14))->save());
578
579
        $node = new Node(['slug' => 'new2']);
580
        Yii::configure($node->getBehavior('tree'), $config);
581
        $this->assertTrue($node->appendTo(Node::findOne(15))->save());
582
583
        $node = new MultipleTreeNode(['slug' => 'new1']);
584
        Yii::configure($node->getBehavior('tree'), $config);
585
        $this->assertTrue($node->appendTo(MultipleTreeNode::findOne(16))->save());
586
587
        $node = new MultipleTreeNode(['slug' => 'new2']);
588
        Yii::configure($node->getBehavior('tree'), $config);
589
        $this->assertTrue($node->appendTo(MultipleTreeNode::findOne(18))->save());
590
591
        $dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']);
592
        $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-append-to-insert-in-empty-amount-7-no-insert.php'));
593
        $this->assertDataSetsEqual($expectedDataSet, $dataSet);
594
    }
595
596
    public function testAppendToInsertInEmptyAmount13Reserve3()
597
    {