Skip to:
Content

bbPress.org

Changeset 5610


Ignore:
Timestamp:
01/30/2015 06:36:57 PM (10 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.

Location:
trunk
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpunit.xml.dist

    r5323 r5610  
    1212        </testsuite>
    1313    </testsuites>
    14     <logging>
    15         <log type="junit" target="tests/phpunit/build/logs/junit.xml" logIncompleteSkipped="false"/>
    16     </logging>
    1714</phpunit>
  • 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' );
  • trunk/tests/phpunit/testcases/core/functions.php

    r5271 r5610  
    99
    1010    /**
    11      * Ensure that the plugin has been installed and activated.
     11     * Ensure that bbPress function exists
     12     */
     13    function test_bbpress_exists() {
     14        $this->assertTrue( function_exists( 'bbpress' ) );
     15    }
     16
     17    /**
     18     * Ensure that bbPress has been installed and activated.
    1219     */
    1320    function test_plugin_activated() {
Note: See TracChangeset for help on using the changeset viewer.