Skip to:
Content

BuddyPress.org

Changeset 9281


Ignore:
Timestamp:
12/24/2014 09:30:36 PM (6 years ago)
Author:
djpaul
Message:

Unit Tests: tidy up wp_blogs table between tests.

Sites created by the WP_UnitTest_Factory_For_Blog sometimes are not removed when the current transaction is rolled back. This requires further investigation to understand the root cause but for now, we'll empty out the blogs table manually.

See r9280 / #5857.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase.php

    r9142 r9281  
    5555    }
    5656
     57    function tearDown() {
     58        parent::tearDown();
     59
     60        /**
     61         * Sites created by the WP_UnitTest_Factory_For_Blog sometimes are not removed when the current
     62         * transaction is rolled back. This requires further investigation to understand the root cause
     63         * but for now, we'll empty out the blogs table manually.
     64         */
     65        global $wpdb;
     66
     67        $blogs = wp_get_sites();
     68        foreach ( $blogs as $blog ) {
     69            if ( (int) $blog['blog_id'] !== 1 ) {
     70                wpmu_delete_blog( $blog['blog_id'], true );
     71            }
     72        }
     73    }
     74
    5775    function assertPreConditions() {
    5876        parent::assertPreConditions();
Note: See TracChangeset for help on using the changeset viewer.