Tests for bbPress REST API integration.

group common
group rest
package bbPress
inherited_from \BBP_UnitTestCase

 Methods

assertPreConditions()

assertPreConditions() 
Inherited

clean_up_global_scope()

clean_up_global_scope() 
Inherited

Commit a MySQL transaction.

commit_transaction() 
InheritedStatic

Data provider for forum attribute fields exposed by REST.

data_forum_attribute_fields() : array<mixed,array>

Returns

array<mixed,array>Field names.

Enable REST support for a bbPress post type.

enable_rest_support(array $args) : array

Parameters

$args

array

Post type arguments.

Returns

arrayFiltered post type arguments.

go_to()

go_to($url) 
Inherited

Parameters

$url

We can't use grant_super_admin() because we will need to modify the list more than once, and grant_super_admin() can only be run once because of its global check

grant_super_admin($user_id) 
Inherited

Parameters

$user_id

We assume that the global can be wiped out

restore_admins() 
Inherited
see

Set up REST support for bbPress post types.

setUp() 
inherited_from \BBP_UnitTestCase::setUp()

setUp()

setUp() 
Inherited

Fake WP mail globals, to avoid errors

setUpBeforeClass() 
InheritedStatic

Set up globals necessary to avoid errors when using wp_mail()

setUp_wp_mail($args) 
InheritedStatic

Parameters

$args

WP's core tests use wp_set_current_user() to change the current user during tests. BP caches the current user differently, so we have to do a bit more work to change it

set_current_user($user_id) 
InheritedStatic

Parameters

$user_id

Remove REST post type filters.

tearDown() 
inherited_from \BBP_UnitTestCase::tearDown()

tearDown()

tearDown() 
Inherited

Tear down globals set up in setUp_wp_mail()

tearDown_wp_mail($args) 
InheritedStatic

Parameters

$args

test_anonymous_user_can_read_attachments_in_public_forum()

test_anonymous_user_can_read_attachments_in_public_forum() 
covers

test_anonymous_user_can_read_public_attachment_when_parent_post_type_is_not_in_rest()

test_anonymous_user_can_read_public_attachment_when_parent_post_type_is_not_in_rest() 
covers

test_anonymous_user_can_read_public_forum_content()

test_anonymous_user_can_read_public_forum_content() 
covers

test_anonymous_user_cannot_read_attachment_in_hidden_forum()

test_anonymous_user_cannot_read_attachment_in_hidden_forum() 
covers

test_anonymous_user_cannot_read_hidden_forum_content()

test_anonymous_user_cannot_read_hidden_forum_content() 
covers

test_anonymous_user_cannot_read_private_forum_content()

test_anonymous_user_cannot_read_private_forum_content() 
covers

test_anonymous_user_cannot_read_public_descendants_of_hidden_forum()

test_anonymous_user_cannot_read_public_descendants_of_hidden_forum() 
covers

test_collections_exclude_public_descendants_of_hidden_forum()

test_collections_exclude_public_descendants_of_hidden_forum() 
covers

test_filtered_forum_moderator_can_read_hidden_forum_content()

test_filtered_forum_moderator_can_read_hidden_forum_content() 
covers

test_forum_moderator_can_read_hidden_forum_content()

test_forum_moderator_can_read_hidden_forum_content() 
covers

test_global_moderator_can_change_forum_structure_through_rest()

test_global_moderator_can_change_forum_structure_through_rest() 
covers

test_keymaster_can_read_hidden_forum_content()

test_keymaster_can_read_hidden_forum_content() 
covers

test_media_collection_excludes_attachments_in_hidden_forum()

test_media_collection_excludes_attachments_in_hidden_forum() 
covers

test_parent_forum_moderator_can_read_public_descendants_of_hidden_forum()

test_parent_forum_moderator_can_read_public_descendants_of_hidden_forum() 
covers

test_participant_can_read_private_forum_content()

test_participant_can_read_private_forum_content() 
covers

test_participant_can_read_public_descendants_of_private_forum()

test_participant_can_read_public_descendants_of_private_forum() 
covers

test_participant_cannot_read_hidden_forum_content()

test_participant_cannot_read_hidden_forum_content() 
covers

test_participant_cannot_read_public_descendants_of_hidden_forum()

test_participant_cannot_read_public_descendants_of_hidden_forum() 
covers

test_per_forum_moderator_cannot_change_forum_structure_through_rest()

test_per_forum_moderator_cannot_change_forum_structure_through_rest(string $field) 
covers
dataProvider data_forum_attribute_fields

Parameters

$field

string

Field to update.

test_search_excludes_restricted_forum_content()

test_search_excludes_restricted_forum_content() 
covers

Assert all three bbPress REST item routes return a status.

assert_item_status(integer $status, array<mixed,integer> $posts, integer $user_id = 0

Parameters

$status

integer

Expected HTTP status.

$posts

array<mixed,integer>

Forum, topic, and reply IDs.

$user_id

integer

User ID.

Create an attachment for a bbPress post.

create_attachment(integer $parent_id) : integer

Parameters

$parent_id

integer

Parent post ID.

Returns

integerAttachment ID.

Create a forum, topic, and reply with the requested forum status.

create_forum_content(string $status = 'publish', integer $parent_id = 0) : array<mixed,integer>

Parameters

$status

string

Forum status.

$parent_id

integer

Parent forum ID.

Returns

array<mixed,integer>Forum, topic, and reply IDs.

Dispatch a REST request for a bbPress post.

get_item(string $post_type, integer $post_id, integer $user_id = 0) : \WP_REST_Response

Parameters

$post_type

string

Post type route base.

$post_id

integer

Post ID.

$user_id

integer

User ID.

Returns

\WP_REST_ResponseREST response.

Dispatch a REST collection request for a bbPress post type.

get_items(string $post_type, integer $user_id = 0) : \WP_REST_Response

Parameters

$post_type

string

Post type route base.

$user_id

integer

User ID.

Returns

\WP_REST_ResponseREST response.

Dispatch a REST update request for a bbPress post.

update_item(string $post_type, integer $post_id, integer $user_id, array $params) : \WP_REST_Response

Parameters

$post_type

string

Post type route base.

$post_id

integer

Post ID.

$user_id

integer

User ID.

$params

array

Request parameters.

Returns

\WP_REST_ResponseREST response.

 Properties

 

$cached_SERVER_NAME

$cached_SERVER_NAME 

Default

null
Static