Make WordPress Core

Ticket #44767: 44767-test_ignore_empty_lines_completely.diff

File 44767-test_ignore_empty_lines_completely.diff, 1.3 KB (added by soulseekah, 6 years ago)
  • src/wp-admin/includes/upgrade.php

    diff --git src/wp-admin/includes/upgrade.php src/wp-admin/includes/upgrade.php
    index 85439b4..1444ef7 100644
    function dbDelta( $queries = '', $execute = true ) { 
    25532553                        $validfield = true;
    25542554                        switch ( $fieldname_lowercased ) {
    25552555                                case '':
     2556                                        continue 2;
    25562557                                case 'primary':
    25572558                                case 'index':
    25582559                                case 'fulltext':
  • tests/phpunit/tests/dbdelta.php

    diff --git tests/phpunit/tests/dbdelta.php tests/phpunit/tests/dbdelta.php
    index 1e9c93f..f8b6634 100644
    class Tests_dbDelta extends WP_UnitTestCase { 
    996996                        $updates
    997997                );
    998998        }
     999
     1000        /**
     1001         * @ticket 44767
     1002         */
     1003        function test_ignore_empty_lines_completely() {
     1004                global $wpdb;
     1005
     1006                $schema = "
     1007                        CREATE TABLE {$wpdb->prefix}dbdelta_test4 (
     1008                                `foo-bar` varchar(255) DEFAULT NULL,
     1009
     1010                                `foo-baz` varchar(255) DEFAULT NULL
     1011                        )
     1012                ";
     1013
     1014                $wpdb->query( $schema );
     1015
     1016                $schema_update = "
     1017                        CREATE TABLE {$wpdb->prefix}dbdelta_test4 (
     1018                                `foo-bar` varchar(255) DEFAULT NULL,
     1019
     1020
     1021
     1022                                `foo-baz` varchar(255) DEFAULT NULL
     1023                        )
     1024                ";
     1025
     1026                $updates = dbDelta( $schema_update );
     1027
     1028                $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}dbdelta_test4" );
     1029
     1030                $this->assertEmpty( $updates );
     1031        }
    9991032}