Skip to:
Content

bbPress.org


Ignore:
Timestamp:
01/30/2015 06:36:57 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Port PHPUnit testing setup from BuddyPress. More to clean up here later.

Also adds 1 test to check for bbpress() function availability.

See #2542.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/bootstrap.php

    r5279 r5610  
    11<?php
    22
    3 /**
    4  * Bootstrap the plugin unit testing environment.
    5  *
    6  * Edit 'active_plugins' setting below to point to your main plugin file.
    7  *
    8  * @package wordpress-plugin-tests
    9  */
     3// Define our constants
     4echo "Defining constants...\n";
     5require( dirname( __FILE__ ) . '/includes/define-constants.php' );
    106
    11 // Activates this plugin in WordPress so it can be tested.
     7echo "Ensure bbPress is an active plugin...\n";
    128$GLOBALS['wp_tests_options'] = array(
    139    'active_plugins' => array( 'bbpress/bbpress.php' ),
    1410);
    1511
    16 // If the develop repo location is defined (as WP_DEVELOP_DIR), use that
    17 // location. Otherwise, we'll just assume that this plugin is installed in a
    18 // WordPress develop SVN checkout.
     12// Bail if test suite cannot be found
     13if ( ! file_exists( WP_TESTS_DIR . '/includes/functions.php' ) ) {
     14    die( "The WordPress PHPUnit test suite could not be found.\n" );
     15} else {
     16    echo "Loading WordPress PHPUnit test suite...\n";
     17    require( WP_TESTS_DIR . '/includes/functions.php' );
     18}
    1919
    20 if( false !== getenv( 'WP_DEVELOP_DIR' ) ) {
    21     require getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit/includes/bootstrap.php';
    22 } else {
    23     require '../../../../tests/phpunit/includes/bootstrap.php';
     20/**
     21 * Load bbPress's PHPUnit test suite loader
     22 */
     23function _load_loader() {
     24    require( BBP_TESTS_DIR . '/includes/loader.php' );
    2425}
     26tests_add_filter( 'muplugins_loaded', '_load_loader' );
     27
     28echo "Loading WordPress bootstrap...\n";
     29require( WP_TESTS_DIR . '/includes/bootstrap.php' );
     30
     31echo "Loading bbPress testcase...\n";
     32require( BBP_TESTS_DIR . '/includes/testcase.php' );
Note: See TracChangeset for help on using the changeset viewer.