Code Duplication    Length = 23-23 lines in 3 locations

tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php 3 locations

@@ 390-412 (lines=23) @@
387
    /**
388
     * @group DBAL-2302
389
     */
390
    public function testDropNonAutoincrementColumnFromCompositePrimaryKeyWithAutoincrementColumn()
391
    {
392
        $table = new Table("tbl");
393
        $table->addColumn('id', 'integer', array('autoincrement' => true));
394
        $table->addColumn('foo', 'integer');
395
        $table->addColumn('bar', 'integer');
396
        $table->setPrimaryKey(array('id', 'foo'));
397
398
        $comparator = new Comparator();
399
        $diffTable = clone $table;
400
401
        $diffTable->dropPrimaryKey();
402
        $diffTable->setPrimaryKey(array('id'));
403
404
        self::assertSame(
405
            array(
406
                'ALTER TABLE tbl MODIFY id INT NOT NULL',
407
                'ALTER TABLE tbl DROP PRIMARY KEY',
408
                'ALTER TABLE tbl ADD PRIMARY KEY (id)',
409
            ),
410
            $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable))
411
        );
412
    }
413
414
    /**
415
     * @group DBAL-2302
@@ 417-439 (lines=23) @@
414
    /**
415
     * @group DBAL-2302
416
     */
417
    public function testAddNonAutoincrementColumnToPrimaryKeyWithAutoincrementColumn()
418
    {
419
        $table = new Table("tbl");
420
        $table->addColumn('id', 'integer', array('autoincrement' => true));
421
        $table->addColumn('foo', 'integer');
422
        $table->addColumn('bar', 'integer');
423
        $table->setPrimaryKey(array('id'));
424
425
        $comparator = new Comparator();
426
        $diffTable = clone $table;
427
428
        $diffTable->dropPrimaryKey();
429
        $diffTable->setPrimaryKey(array('id', 'foo'));
430
431
        self::assertSame(
432
            array(
433
                'ALTER TABLE tbl MODIFY id INT NOT NULL',
434
                'ALTER TABLE tbl DROP PRIMARY KEY',
435
                'ALTER TABLE tbl ADD PRIMARY KEY (id, foo)',
436
            ),
437
            $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable))
438
        );
439
    }
440
441
    /**
442
     * @group DBAL-586
@@ 477-499 (lines=23) @@
474
        ), $sql);
475
    }
476
    
477
    public function testAlterPrimaryKeyWithNewColumn()
478
    {
479
        $table = new Table("yolo");
480
        $table->addColumn('pkc1', 'integer');
481
        $table->addColumn('col_a', 'integer');
482
        $table->setPrimaryKey(array('pkc1'));
483
484
        $comparator = new Comparator();
485
        $diffTable = clone $table;
486
        
487
        $diffTable->addColumn('pkc2', 'integer');
488
        $diffTable->dropPrimaryKey();
489
        $diffTable->setPrimaryKey(array('pkc1', 'pkc2'));
490
491
        self::assertSame(
492
            array(
493
                'ALTER TABLE yolo DROP PRIMARY KEY',
494
                'ALTER TABLE yolo ADD pkc2 INT NOT NULL',
495
                'ALTER TABLE yolo ADD PRIMARY KEY (pkc1, pkc2)',
496
            ),
497
            $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable))
498
        );      
499
    }
500
501
    public function testInitializesDoctrineTypeMappings()
502
    {