Changeset 36552
- Timestamp:
- 02/17/2016 06:54:27 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/dbdelta.php
r35487 r36552 34 34 PRIMARY KEY (id), 35 35 KEY key_1 (column_1), 36 KEY compou d_key (id,column_1),36 KEY compound_key (id,column_1), 37 37 FULLTEXT KEY fulltext_key (column_1) 38 38 ) ENGINE=MyISAM … … 106 106 PRIMARY KEY (id), 107 107 KEY key_1 (column_1), 108 KEY compou d_key (id,column_1)108 KEY compound_key (id,column_1) 109 109 ) 110 110 " … … 129 129 PRIMARY KEY (id), 130 130 KEY key_1 (column_1), 131 KEY compou d_key (id,column_1)131 KEY compound_key (id,column_1) 132 132 ) 133 133 " … … 158 158 PRIMARY KEY (id), 159 159 KEY key_1 (column_1), 160 KEY compou d_key (id,column_1)160 KEY compound_key (id,column_1) 161 161 ) 162 162 " … … 172 172 173 173 $this->assertTableHasColumn( 'column_1', $wpdb->prefix . 'dbdelta_test' ); 174 $this->assertTableHasPrimaryKey( 'id' , $wpdb->prefix . 'dbdelta_test' ); 174 175 } 175 176 … … 190 191 PRIMARY KEY (id), 191 192 KEY key_1 (column_1), 192 KEY compou d_key (id,column_1)193 KEY compound_key (id,column_1) 193 194 ) 194 195 " … … 216 217 PRIMARY KEY (id), 217 218 KEY key_1 (column_1), 218 KEY compou d_key (id,column_1)219 KEY compound_key (id,column_1) 219 220 ) 220 221 " … … 266 267 PRIMARY KEY (id), 267 268 KEY key_1 (column_1), 268 KEY compou d_key (id,column_1),269 KEY compound_key (id,column_1), 269 270 FULLTEXT KEY fulltext_key (column_1) 270 271 ) … … 287 288 */ 288 289 protected function assertTableRowHasValue( $column, $value, $table ) { 289 290 290 global $wpdb; 291 291 … … 306 306 */ 307 307 protected function assertTableHasColumn( $column, $table ) { 308 309 308 global $wpdb; 310 309 … … 312 311 313 312 $this->assertCount( 1, wp_list_filter( $table_fields, array( 'Field' => $column ) ) ); 313 } 314 315 /** 316 * Assert that a table has a primary key. 317 * 318 * Checks for single-column primary keys. May not work for multi-column primary keys. 319 * 320 * @param string $column The column for the primary key. 321 * @param string $table The database table name. 322 */ 323 protected function assertTableHasPrimaryKey( $column , $table ) { 324 global $wpdb; 325 326 $table_indices = $wpdb->get_results( "SHOW INDEX FROM {$table}" ); 327 328 $this->assertCount( 1, wp_list_filter( $table_indices, array( 'Key_name' => 'PRIMARY' , 'Column_name' => $column ) , 'AND' ) ); 314 329 } 315 330
Note: See TracChangeset
for help on using the changeset viewer.