[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

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

   1  <?php
   2  /**
   3   * Installs BuddyPress for the purpose of the unit-tests
   4   *
   5   * @todo Reuse the init/load code in init.php
   6   * @todo Support MULTIBLOG
   7   */
   8  error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT );
   9  
  10  $config_file_path = $argv[1];
  11  $tests_dir_path = $argv[2];
  12  $multisite = ! empty( $argv[3] );
  13  
  14  require_once $config_file_path;
  15  require_once $tests_dir_path . '/includes/functions.php';
  16  require_once $tests_dir_path . '/includes/mock-mailer.php';
  17  
  18  function _load_buddypress() {
  19      require dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/src/bp-loader.php';
  20      do_action( 'activate_src/bp-loader.php' );
  21  }
  22  tests_add_filter( 'muplugins_loaded', '_load_buddypress' );
  23  
  24  define( 'BP_PLUGIN_DIR', dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/src/' );
  25  define( 'BP_ROOT_BLOG', 1 );
  26  
  27  // Always load admin bar
  28  tests_add_filter( 'show_admin_bar', '__return_true' );
  29  
  30  function wp_test_bp_install( $value ) {
  31      return array( 'activity' => 1, 'blogs' => 1, 'friends' => 1, 'groups' => 1, 'members' => 1, 'messages' => 1, 'notifications' => 1, 'settings' => 1, 'xprofile' => 1, );
  32  }
  33  tests_add_filter( 'bp_new_install_default_components', 'wp_test_bp_install' );
  34  
  35  tests_add_filter( 'bp_get_signup_allowed', '__return_true' );
  36  
  37  $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
  38  $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN;
  39  $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
  40  
  41  require_once ABSPATH . '/wp-settings.php';
  42  
  43  echo "Installing BuddyPress...\n";
  44  
  45  $wpdb->query( 'SET default_storage_engine = INNODB' );
  46  $wpdb->select( DB_NAME, $wpdb->dbh );
  47  
  48  // Drop BuddyPress tables.
  49  foreach ( $wpdb->get_col( "SHOW TABLES LIKE '" . $wpdb->prefix . "bp%'" ) as $bp_table ) {
  50      $wpdb->query( "DROP TABLE {$bp_table}" );
  51  }
  52  
  53  function _bp_mock_mailer( $class ) {
  54      return 'BP_UnitTest_Mailer';
  55  }
  56  tests_add_filter( 'bp_send_email_delivery_class', '_bp_mock_mailer' );
  57  
  58  // Install BuddyPress
  59  bp_version_updater();


Generated: Fri Apr 19 01:01:08 2024 Cross-referenced by PHPXref 0.7.1