mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Share fixtures across a number of query-related test classes.
This shaves 10-20 seconds off the running time for the suite. See #30017. git-svn-id: https://develop.svn.wordpress.org/trunk@30276 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -167,6 +167,16 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||
add_filter( 'query', array( $this, '_drop_temporary_tables' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit the queries in a transaction.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
public static function commit_transaction() {
|
||||
global $wpdb;
|
||||
$wpdb->query( 'COMMIT;' );
|
||||
}
|
||||
|
||||
function _create_temporary_tables( $query ) {
|
||||
if ( 'CREATE TABLE' === substr( trim( $query ), 0, 12 ) )
|
||||
return substr_replace( trim( $query ), 'CREATE TEMPORARY TABLE', 0, 12 );
|
||||
|
||||
Reference in New Issue
Block a user