Code Duplication    Length = 20-25 lines in 2 locations

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

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