Manually delete fixture in `test_mysqli_flush_sync()`.

This test creates a dummy post and subsequently runs a query containing
`DROP PROCEDURE`. This latter query implies a `COMMIT`, which means that the
post is not cleaned up for later tests. Manually deleting the post with
`wp_delete_post()` solves this problem.

Fixes #28155.

git-svn-id: https://develop.svn.wordpress.org/trunk@30320 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2014-11-13 01:59:49 +00:00
parent ca39f65025
commit f5d88c355e
1 changed files with 4 additions and 1 deletions

View File

@ -482,11 +482,14 @@ class Tests_DB extends WP_UnitTestCase {
$this->markTestSkipped( 'procedure could not be created (missing privileges?)' );
}
$this->factory->post->create();
$post_id = $this->factory->post->create();
$this->assertNotEmpty( $wpdb->get_results( 'CALL `test_mysqli_flush_sync_procedure`' ) );
$this->assertNotEmpty( $wpdb->get_results( "SELECT ID FROM `{$wpdb->posts}` LIMIT 1" ) );
// DROP PROCEDURE will cause a COMMIT, so we delete the post manually before that happens.
wp_delete_post( $post_id, true );
$wpdb->query( 'DROP PROCEDURE IF EXISTS `test_mysqli_flush_sync_procedure`' );
$wpdb->suppress_errors( $suppress );
}