You appear to be a bot. Output may be restricted
Description
Test a POST request, with the attributes in the body.
Usage
REST_Block_Renderer_Controller_Test::test_get_item_post_request();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/rest-api/rest-block-renderer-controller.php
Lines:
1 to 14 of 14
public function test_get_item_post_request() { wp_set_current_user( self::$user_id ); $string_attribute = 'Lorem ipsum dolor'; $attributes = array( 'some_string' => $string_attribute ); $request = new WP_REST_Request( 'POST', self::$rest_api_route . self::$block_name ); $request->set_param( 'context', 'edit' ); $request->set_header( 'content-type', 'application/json' ); $request->set_body( wp_json_encode( compact( 'attributes' ) ) ); $response = rest_get_server()->dispatch( $request ); $this->assertSame( 200, $response->get_status() ); $this->assertStringContainsString( $string_attribute, $response->get_data()['rendered'] ); }