Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/29/2015 09:42:43 PM (10 years ago)
Author:
boonebgorges
Message:

More targeted cleanup for unit tests that use bp_blogs_record_existing_blogs().

bp_blogs_record_existing_blogs() uses TRUNCATE, which closes the MySQL
transaction started by the WP automated test suite. As a result, fixtures
created before the TRUNCATE are not properly rolled back during tearDown().
Previously, the workaround for the problem had been heavy-handed: the wholesale
deletion of certain content during every test setup/teardown. The new technique
is to detect when a known autocommit has taken place - as it does in
bp_blogs_record_existing_blogs() - and to do a more targeted cleanup only in
these cases.

This allows us to dispense with various instances of blog fixture cleanup in
existing tests.

Fixes #6540.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/blogs/class-bp-blogs-blog.php

    r9819 r9980  
    2828
    2929        $this->assertEquals( array( $b ), $blog_ids );
    30 
    31         $this->set_current_user( $old_user );
    32         wpmu_delete_blog( $b, true );
    3330    }
    3431
     
    6158        $this->assertEquals( array( $b ), $blog_ids );
    6259        $this->assertEquals( 1, $blogs['total'] );
    63 
    64         $this->set_current_user( $old_user );
    65         wpmu_delete_blog( $b, true );
    6660    }
    6761
     
    8983
    9084        $this->assertEquals( array( $b ), $blog_ids );
    91 
    92         $this->set_current_user( $old_user );
    93         wpmu_delete_blog( $b, true );
    9485    }
    9586
     
    120111
    121112        $this->assertEquals( array( $b ), $blog_ids );
    122 
    123         $this->set_current_user( $old_user );
    124         wpmu_delete_blog( $b, true );
    125113    }
    126114
     
    182170
    183171        $this->set_current_user( $old_user );
    184 
    185         foreach ( $bs as $d ) {
    186             wpmu_delete_blog( $d, true );
    187         }
    188172    }
    189173}
Note: See TracChangeset for help on using the changeset viewer.