From f5d88c355e383e063bbd144fc83f4dff0e1f4866 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 13 Nov 2014 01:59:49 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/db.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/db.php b/tests/phpunit/tests/db.php index 601380234c..62a056f05b 100644 --- a/tests/phpunit/tests/db.php +++ b/tests/phpunit/tests/db.php @@ -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 ); }