1
0
Fork 0
mirror of https://github.com/buddypress/buddypress.git synced 2026-07-22 20:56:55 +08:00
buddypress/tests/phpunit/assets/bp-rest-api-controllers.php
Mathieu Viet be4fcf4f4c Improve PHP 8.2 compatibility
- Add the `#[AllowDynamicProperties]` attribute to classes when we add dynamic properties to these into our codebase.
- Add PHP 8.2 to our PHPUnit testing matrix

Closes https://github.com/buddypress/buddypress/pull/62
Fixes #8820



git-svn-id: https://buddypress.svn.wordpress.org/trunk@13414 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
2023-02-10 03:12:09 +00:00

72 lines
1.8 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.
*/
#[AllowDynamicProperties]
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.
*/
#[AllowDynamicProperties]
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.
*/
#[AllowDynamicProperties]
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.
*/
#[AllowDynamicProperties]
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' );
}
}