mirror of
git://develop.git.wordpress.org/
synced 2025-02-12 02:44:22 +01:00
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:
parent
967fcbdc61
commit
9eaab508ab
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user