[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/tests/phpunit/includes/ -> loader.php (source)

   1  <?php
   2  
   3  require_once( dirname( __FILE__ ) . '/define-constants.php' );
   4  
   5  $multisite = (int) ( defined( 'WP_TESTS_MULTISITE') && WP_TESTS_MULTISITE );
   6  system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( WP_TESTS_CONFIG_PATH ) . ' ' . escapeshellarg( WP_TESTS_DIR ) . ' ' . $multisite );
   7  
   8  // Bootstrap BP
   9  require dirname( __FILE__ ) . '/../../../src/bp-loader.php';
  10  
  11  // Bail from redirects as they throw 'headers already sent' warnings.
  12  tests_add_filter( 'wp_redirect', '__return_false' );
  13  
  14  require_once( dirname( __FILE__ ) . '/mock-mailer.php' );
  15  function _bp_mock_mailer( $class ) {
  16      return 'BP_UnitTest_Mailer';
  17  }
  18  tests_add_filter( 'bp_send_email_delivery_class', '_bp_mock_mailer' );
  19  
  20  /**
  21   * Load up component action and screen code.
  22   *
  23   * In BuddyPress, this is loaded conditionally, but PHPUnit needs all files
  24   * loaded at the same time to prevent weird load order issues.
  25   */
  26  $components = array( 'activity', 'blogs', 'friends', 'groups', 'members', 'messages', 'notifications', 'settings', 'xprofile' );
  27  foreach ( $components as $component ) {
  28      add_action( "bp_{$component}_includes", function() use ( $component ) {
  29          $dirs = array(
  30              buddypress()->plugin_dir . 'bp-' . $component . '/actions/',
  31              buddypress()->plugin_dir . 'bp-' . $component . '/screens/',
  32          );
  33  
  34          foreach ( $dirs as $dir ) {
  35              foreach ( glob( $dir . "*.php" ) as $file ) {
  36                  require $file;
  37              }
  38          }
  39      } );
  40  }


Generated: Thu Dec 12 01:01:02 2024 Cross-referenced by PHPXref 0.7.1