Database: Add unit test to test that a column type change for a table name with a hyphen is working after [37583].

Fixes #31679.

git-svn-id: https://develop.svn.wordpress.org/trunk@38044 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling 2016-07-13 11:38:29 +00:00
parent 967fcbdc61
commit 9eaab508ab
1 changed files with 32 additions and 0 deletions

View File

@ -801,4 +801,36 @@ class Tests_dbDelta extends WP_UnitTestCase {
$this->assertEmpty( $updates );
}
/**
* @ticket 31679
*/
function test_column_type_change_with_hyphens_in_name() {
global $wpdb;
$schema = "
CREATE TABLE {$wpdb->prefix}dbdelta_test2 (
`foo-bar` varchar(255) DEFAULT NULL
)
";
$wpdb->query( $schema );
$schema_update = "
CREATE TABLE {$wpdb->prefix}dbdelta_test2 (
`foo-bar` text DEFAULT NULL
)
";
$updates = dbDelta( $schema_update );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}dbdelta_test2" );
$this->assertSame(
array(
"{$wpdb->prefix}dbdelta_test2.foo-bar" => "Changed type of {$wpdb->prefix}dbdelta_test2.foo-bar from varchar(255) to text",
),
$updates
);
}
}