Changeset 27041 for trunk/tests/phpunit/includes/testcase.php
- Timestamp:
- 01/27/2014 03:09:13 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r26909 r27041 36 36 $this->expectedDeprecated(); 37 37 $wpdb->query( 'ROLLBACK' ); 38 remove_filter( ' dbdelta_create_queries', array( $this, '_create_temporary_tables' ) );39 remove_filter( 'query', array( $this, '_drop_temporary_table s' ) );38 remove_filter( 'query', array( $this, '_create_temporary_table' ) ); 39 remove_filter( 'query', array( $this, '_drop_temporary_table' ) ); 40 40 remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) ); 41 41 } … … 65 65 $wpdb->query( 'SET autocommit = 0;' ); 66 66 $wpdb->query( 'START TRANSACTION;' ); 67 add_filter( 'dbdelta_create_queries', array( $this, '_create_temporary_tables' ) ); 68 add_filter( 'query', array( $this, '_drop_temporary_tables' ) ); 69 } 70 71 function _create_temporary_tables( $queries ) { 72 return str_replace( 'CREATE TABLE', 'CREATE TEMPORARY TABLE', $queries ); 73 } 74 75 function _drop_temporary_tables( $query ) { 67 add_filter( 'query', array( $this, '_create_temporary_table' ) ); 68 add_filter( 'query', array( $this, '_drop_temporary_table' ) ); 69 } 70 71 function _create_temporary_table( $query ) { 72 if ( 'CREATE TABLE' === substr( $query, 0, 12 ) ) 73 return substr_replace( $query, 'CREATE TEMPORARY TABLE', 0, 12 ); 74 return $query; 75 } 76 77 function _drop_temporary_table( $query ) { 76 78 if ( 'DROP TABLE' === substr( $query, 0, 10 ) ) 77 return 'DROP TEMPORARY TABLE ' . substr( $query, 10 );79 return substr_replace( $query, 'DROP TEMPORARY TABLE', 0, 10 ); 78 80 return $query; 79 81 }
Note: See TracChangeset
for help on using the changeset viewer.