1
0
Fork 0
mirror of https://github.com/buddypress/buddypress.git synced 2026-07-22 20:56:55 +08:00
buddypress/tests/phpunit/bootstrap.php
Renato Alves 41802f7709 Include the V2 of the BP REST API in BuddyPress core.
We are officially deprecating the V1 of the BP REST API. And bundling the new, default, V2 of the BP REST API inside BuddyPress core. Previously, the V1 was developed as a plugin in a separate repo (https://github.com/buddypress/BP-REST).

- One of the main differences between the V1 and V2 is how objects are returned. Single items are no longer returned as an `array`;
- We have a new `BP_Test_REST_Controller_Testcase` for testing the new API endpoints;
- We changed the names of our controllers to follow our autoloader rules;
- Removed the BP-REST plugin from `wp-env` and from our release script;
- And we added notices for the deprecated V1 API (endpoints and files).

Props imath & I. ;)

Fixes #8200
See #9145
Closes https://github.com/buddypress/buddypress/pull/337

git-svn-id: https://buddypress.svn.wordpress.org/trunk@14026 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
2024-09-27 21:11:27 +00:00

42 lines
1.1 KiB
PHP

<?php
const WP_TESTS_PHPUNIT_POLYFILLS_PATH = __DIR__ . '/../../vendor/yoast/phpunit-polyfills';
require __DIR__ . '/includes/define-constants.php';
if ( ! file_exists( WP_TESTS_DIR . '/includes/functions.php' ) ) {
die( "The WordPress PHPUnit test suite could not be found.\n" );
}
require_once WP_TESTS_DIR . '/includes/functions.php';
function _install_and_load_buddypress() {
require BP_TESTS_DIR . '/includes/loader.php';
}
tests_add_filter( 'muplugins_loaded', '_install_and_load_buddypress' );
require WP_TESTS_DIR . '/includes/bootstrap.php';
// Load the BP-specific testing tools.
require BP_TESTS_DIR . '/includes/testcase.php';
require BP_TESTS_DIR . '/includes/testcase-emails.php';
require BP_TESTS_DIR . '/includes/testcase-rest-controller.php';
/**
* Set component visibility.
*
* @param bool $visibility Visibility.
*/
function toggle_component_visibility( $visibility = true ) {
$visibility = $visibility ? 'members' : 'anyone';
update_option(
'_bp_community_visibility',
array(
'global' => $visibility,
'activity' => $visibility,
'members' => $visibility,
'groups' => $visibility,
'blogs' => $visibility,
)
);
}