Code Duplication    Length = 20-25 lines in 2 locations

tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php 2 locations

@@ 376-400 (lines=25) @@
373
     * @link https://mariadb.com/kb/en/library/information-schema-columns-table/
374
     * @link https://dev.mysql.com/doc/refman/5.5/en/string-literals.html
375
     */
376
    public function testColumnDefaultValuesDoubleQuoted(): void
377
    {
378
379
        $table = new Table("test_column_default_values_double_quoted");
380
        $table->addColumn('string_nullable_quoted', 'string', ['notnull' => false, 'default' => 'NULL']);
381
        $table->addColumn('string_nullable_double_quoted', 'string', ['notnull' => false, 'default' => "'NULL'"]);
382
383
        $table->addColumn('string_notnull_quoted', 'string', ['notnull' => true, 'default' => 'NULL']);
384
        //$table->addColumn('string_notnull_double_quoted', 'string', ['notnull' => true, 'default' => "\\'NULL\\'"]);
385
386
        $this->_sm->dropAndCreateTable($table);
387
388
        $onlineTable = $this->_sm->listTableDetails("test_column_default_values_double_quoted");
389
        self::assertSame('NULL', $onlineTable->getColumn('string_nullable_quoted')->getDefault());
390
391
        self::assertSame("'NULL'", $onlineTable->getColumn('string_nullable_double_quoted')->getDefault());
392
        self::assertSame("NULL", $onlineTable->getColumn('string_notnull_quoted')->getDefault());
393
        //self::assertSame("'NULL'", $onlineTable->getColumn('string_notnull_double_quoted')->getDefault());
394
395
        $comparator = new Comparator();
396
397
        $diff = $comparator->diffTable($table, $onlineTable);
398
        $this->assertFalse($diff, "Tables should be identical with double quoted literals.");
399
400
    }
401
402
403
    public function testColumnDefaultCurrentTimestamp(): void
@@ 466-485 (lines=20) @@
463
     *
464
     * @link https://mariadb.com/kb/en/library/string-literals
465
     */
466
    public function testColumnDefaultValuesEscaping(): void
467
    {
468
        $table = new Table("test_column_default_values_escaping");
469
        $table->addColumn('no_quotes', 'string', ['notnull' => false, 'default' => 'az']);
470
471
        $table->addColumn('backslash', 'string', ['notnull' => false, 'default' => 'a\\\z']);
472
        $table->addColumn('repeated_single_quotes', 'string', ['notnull' => false, 'default' => "a''z"]);
473
474
        $this->_sm->dropAndCreateTable($table);
475
476
        $onlineTable = $this->_sm->listTableDetails("test_column_default_values_escaping");
477
        self::assertSame("az", $onlineTable->getColumn('no_quotes')->getDefault());
478
        self::assertSame('a\\\z', $onlineTable->getColumn('backslash')->getDefault());
479
        self::assertSame("a''z", $onlineTable->getColumn('repeated_single_quotes')->getDefault());
480
481
        $comparator = new Comparator();
482
483
        $diff = $comparator->diffTable($table, $onlineTable);
484
        $this->assertFalse($diff, "Tables should be identical with values escape sequences.");
485
    }
486
487
    public function testColumnDefaultsUsingDoctrineTable(): void
488
    {