Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/01/2016 03:44:48 AM (8 years ago)
Author:
boonebgorges
Message:

Tests: Set up page mappings in setUp() rather than setUpBeforeClass().

Since https://core.trac.wordpress.org/changeset/38398, wp_posts data
that has been committed will be deleted by WP_UnitTestCase after each
test. So we need to ensure that the data exists before each test.

Fixes #7241.

File:
1 edited

Legend:

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

    r10545 r11055  
    2727
    2828    public static function setUpBeforeClass() {
     29
     30        // Fake WP mail globals, to avoid errors
     31        add_filter( 'wp_mail', array( 'BP_UnitTestCase', 'setUp_wp_mail' ) );
     32        add_filter( 'wp_mail_from', array( 'BP_UnitTestCase', 'tearDown_wp_mail' ) );
     33    }
     34
     35    public function setUp() {
     36        parent::setUp();
    2937
    3038        /*
     
    3442        bp_core_add_page_mappings( bp_get_option( 'bp-active-components' ), 'delete' );
    3543
    36         // Fake WP mail globals, to avoid errors
    37         add_filter( 'wp_mail', array( 'BP_UnitTestCase', 'setUp_wp_mail' ) );
    38         add_filter( 'wp_mail_from', array( 'BP_UnitTestCase', 'tearDown_wp_mail' ) );
    39     }
    40 
    41     public function setUp() {
    42         parent::setUp();
    4344
    4445        $this->factory = new BP_UnitTest_Factory;
Note: See TracChangeset for help on using the changeset viewer.