1
0
Fork 0
mirror of https://github.com/buddypress/buddypress.git synced 2026-07-23 21:06:56 +08:00
buddypress/tests/phpunit/includes/install.php
Renato Alves f7a818e9c1
Some checks are pending
Unit Tests / tests (false, , 7.4, 6.4) (push) Waiting to run
Unit Tests / tests (false, , 8.1, latest) (push) Waiting to run
Unit Tests / tests (false, , 8.2, 6.4) (push) Waiting to run
Unit Tests / tests (false, memcached, 8.3, trunk) (push) Waiting to run
Unit Tests / tests (false, redis, 8.5, trunk) (push) Waiting to run
Unit Tests / tests (true, , 7.4, 6.4) (push) Waiting to run
Unit Tests / tests (true, memcached, 8.5, 6.9) (push) Waiting to run
Unit Tests / tests (true, redis, 8.3, trunk) (push) Waiting to run
Unit Tests / tests (true, redis, 8.4, trunk) (push) Waiting to run
Code Modernization: Suppress E_STRICT notice only for PHP < 7.4 since its
git-svn-id: https://buddypress.svn.wordpress.org/trunk@14153 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
2025-12-17 13:24:12 +00:00

65 lines
2 KiB
PHP

<?php
/**
* Installs BuddyPress for the purpose of the unit-tests
*
* @todo Reuse the init/load code in init.php
* @todo Support MULTIBLOG
*/
// E_STRICT is deprecated as of PHP 8.4.
if (PHP_VERSION_ID >= 70400) {
error_reporting(E_ALL & ~E_DEPRECATED);
} else {
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
}
$config_file_path = $argv[1];
$tests_dir_path = $argv[2];
$multisite = ! empty( $argv[3] );
require_once $config_file_path;
require_once $tests_dir_path . '/includes/functions.php';
require_once $tests_dir_path . '/includes/mock-mailer.php';
function _load_buddypress() {
require dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/src/bp-loader.php';
do_action( 'activate_src/bp-loader.php' );
}
tests_add_filter( 'muplugins_loaded', '_load_buddypress' );
define( 'BP_PLUGIN_DIR', dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/src/' );
define( 'BP_ROOT_BLOG', 1 );
// Always load admin bar
tests_add_filter( 'show_admin_bar', '__return_true' );
function wp_test_bp_install( $value ) {
return array( 'activity' => 1, 'blogs' => 1, 'friends' => 1, 'groups' => 1, 'members' => 1, 'messages' => 1, 'notifications' => 1, 'settings' => 1, 'xprofile' => 1, );
}
tests_add_filter( 'bp_new_install_default_components', 'wp_test_bp_install' );
tests_add_filter( 'bp_get_signup_allowed', '__return_true' );
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
$_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN;
$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
require_once ABSPATH . '/wp-settings.php';
echo "Installing BuddyPress...\n";
$wpdb->query( 'SET default_storage_engine = INNODB' );
$wpdb->select( DB_NAME, $wpdb->dbh );
// Drop BuddyPress tables.
foreach ( $wpdb->get_col( "SHOW TABLES LIKE '" . $wpdb->prefix . "bp%'" ) as $bp_table ) {
$wpdb->query( "DROP TABLE {$bp_table}" );
}
function _bp_mock_mailer( $class ) {
return 'BP_UnitTest_Mailer';
}
tests_add_filter( 'bp_send_email_delivery_class', '_bp_mock_mailer' );
// Install BuddyPress
bp_version_updater();