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
arrayPost type arguments.
Returns
arrayFiltered post type arguments.
go_to()
go_to($url)
Inherited
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
We assume that the global can be wiped out
restore_admins()
Inherited
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
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
Utility method that resets permalinks and flushes rewrites.
set_permalink_structure(string $structure = '')
Inherited
| since |
2.6.0 bbPress (r5947) |
| global |
WP_Rewrite $wp_rewrite |
Parameters
$structure
stringOptional. Permalink structure to set. Default empty.
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
test_anonymous_user_can_read_attachments_in_public_forum()
test_anonymous_user_can_read_attachments_in_public_forum()
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()
test_anonymous_user_can_read_public_forum_content()
test_anonymous_user_can_read_public_forum_content()
test_anonymous_user_cannot_read_attachment_in_hidden_forum()
test_anonymous_user_cannot_read_attachment_in_hidden_forum()
test_anonymous_user_cannot_read_hidden_forum_content()
test_anonymous_user_cannot_read_hidden_forum_content()
test_anonymous_user_cannot_read_private_forum_content()
test_anonymous_user_cannot_read_private_forum_content()
test_anonymous_user_cannot_read_public_descendants_of_hidden_forum()
test_anonymous_user_cannot_read_public_descendants_of_hidden_forum()
test_collections_exclude_public_descendants_of_hidden_forum()
test_collections_exclude_public_descendants_of_hidden_forum()
test_filtered_forum_moderator_can_read_hidden_forum_content()
test_filtered_forum_moderator_can_read_hidden_forum_content()
test_forum_moderator_can_read_hidden_forum_content()
test_forum_moderator_can_read_hidden_forum_content()
test_global_moderator_can_change_forum_structure_through_rest()
test_global_moderator_can_change_forum_structure_through_rest()
test_keymaster_can_read_hidden_forum_content()
test_keymaster_can_read_hidden_forum_content()
test_parent_forum_moderator_can_read_public_descendants_of_hidden_forum()
test_parent_forum_moderator_can_read_public_descendants_of_hidden_forum()
test_participant_can_read_private_forum_content()
test_participant_can_read_private_forum_content()
test_participant_can_read_public_descendants_of_private_forum()
test_participant_can_read_public_descendants_of_private_forum()
test_participant_cannot_read_hidden_forum_content()
test_participant_cannot_read_hidden_forum_content()
test_participant_cannot_read_public_descendants_of_hidden_forum()
test_participant_cannot_read_public_descendants_of_hidden_forum()
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
stringField to update.
test_search_excludes_restricted_forum_content()
test_search_excludes_restricted_forum_content()
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
integerExpected HTTP status.
$posts
array<mixed,integer>Forum, topic, and reply IDs.
Create an attachment for a bbPress post.
create_attachment(integer $parent_id) : integer
Parameters
$parent_id
integerParent 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
stringForum status.
$parent_id
integerParent 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
stringPost type route base.
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
stringPost type route base.
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
stringPost type route base.
$params
arrayRequest parameters.
Returns
\WP_REST_ResponseREST response.
Properties
$cached_SERVER_NAME
$cached_SERVER_NAME
Static