1
0
Fork 0
mirror of https://github.com/buddypress/buddypress.git synced 2026-07-21 20:54:17 +08:00
buddypress/tests/phpunit/assets/bp-rest-api-controllers.php
Mathieu Viet e8dac6f952 Prepare the inclusion of the BP REST API remaining endpoints
6.0.0 is introducing 6 new BP REST API endpoints :

- Blogs, Blog avatar,
- Friends,
- Group Cover image,
- Member Cover Image and User Signups

We're also reorganizing files, making sure they are located to their belonging endpoints. As a result, 2 files are now deprecated:

- `bp-core/classes/class-bp-rest-attachments-group-avatar-endpoint.php` (moved into `bp-groups/classes`)
- `bp-core/classes/class-bp-rest-attachments-member-avatar-endpoint.php` (moved into `bp-members/classes`)

Props espellcaste, boonebgorges & I ;)

Fixes #7156


git-svn-id: https://buddypress.svn.wordpress.org/trunk@12607 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
2020-03-31 11:33:35 +00:00

68 lines
1.7 KiB
PHP

<?php
/**
* BP REST Controllers' mocks
*/
class BP_REST_Mock_Class {
public function __construct() {}
public function register_routes( $controller = '' ) {
array_push( buddypress()->unit_test_rest->controllers, $controller );
}
}
/**
* BP Member Cover Image REST Controller's mock.
*/
class BP_REST_Attachments_Member_Cover_Endpoint extends BP_REST_Mock_Class {
public function __construct() {
$this->namespace = bp_rest_namespace() . '/' . bp_rest_version();
$this->rest_base = 'members';
}
public function register_routes( $controller = '' ) {
parent::register_routes( 'BP_REST_Attachments_Member_Cover_Endpoint' );
}
}
/**
* BP Member Avatar REST Controller's mock.
*/
class BP_REST_Attachments_Member_Avatar_Endpoint extends BP_REST_Mock_Class {
public function __construct() {
$this->namespace = bp_rest_namespace() . '/' . bp_rest_version();
$this->rest_base = 'members';
}
public function register_routes( $controller = '' ) {
parent::register_routes( 'BP_REST_Attachments_Member_Avatar_Endpoint' );
}
}
/**
* BP Components REST Controller's mock.
*/
class BP_REST_Components_Endpoint extends BP_REST_Mock_Class {
public function __construct() {
$this->namespace = bp_rest_namespace() . '/' . bp_rest_version();
$this->rest_base = 'components';
}
public function register_routes( $controller = '' ) {
parent::register_routes( 'BP_REST_Components_Endpoint' );
}
}
/**
* BP Members REST Controller's mock.
*/
class BP_REST_Members_Endpoint extends BP_REST_Mock_Class {
public function __construct() {
$this->namespace = bp_rest_namespace() . '/' . bp_rest_version();
$this->rest_base = 'members';
}
public function register_routes( $controller = '' ) {
parent::register_routes( 'BP_REST_Members_Endpoint' );
}
}