Changeset 50983 for trunk/tests/phpunit/tests/blocks/block-editor.php
- Timestamp:
- 05/24/2021 09:20:31 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/blocks/block-editor.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/block-editor.php
r50956 r50983 77 77 */ 78 78 function test_block_editor_context_post() { 79 $context = new WP_Block_Editor_Context( array( 'post' => $this->post) );80 81 $this->assertSame( $this->post, $context->post );79 $context = new WP_Block_Editor_Context( array( 'post' => get_post() ) ); 80 81 $this->assertSame( get_post(), $context->post ); 82 82 } 83 83 … … 112 112 add_filter( 'block_categories', array( $this, 'filter_set_block_categories_post' ), 10, 2 ); 113 113 114 $block_categories = get_block_categories( 'post-editor' ); 114 $post_editor_context = new WP_Block_Editor_Context( array( 'post' => get_post() ) ); 115 $block_categories = get_block_categories( $post_editor_context ); 115 116 116 117 remove_filter( 'block_categories', array( $this, 'filter_set_block_categories_post' ) ); … … 132 133 */ 133 134 function test_get_allowed_block_types_default() { 134 $allowed_block_types = get_allowed_block_types( 'post-editor' ); 135 $post_editor_context = new WP_Block_Editor_Context( array( 'post' => get_post() ) ); 136 $allowed_block_types = get_allowed_block_types( $post_editor_context ); 135 137 136 138 $this->assertTrue( $allowed_block_types ); … … 144 146 add_filter( 'allowed_block_types', array( $this, 'filter_set_allowed_block_types_post' ), 10, 2 ); 145 147 146 $allowed_block_types = get_allowed_block_types( 'post-editor' ); 148 $post_editor_context = new WP_Block_Editor_Context( array( 'post' => get_post() ) ); 149 $allowed_block_types = get_allowed_block_types( $post_editor_context ); 147 150 148 151 remove_filter( 'allowed_block_types', array( $this, 'filter_set_allowed_block_types_post' ) ); … … 280 283 add_filter( 'block_editor_settings_all', 'filter_block_editor_settings_my_editor', 10, 1 ); 281 284 282 $settings = get_block_editor_settings( 'my-editor' ); 285 $my_editor_context = new WP_Block_Editor_Context(); 286 $settings = get_block_editor_settings( array(), $my_editor_context ); 283 287 284 288 remove_filter( 'allowed_block_types_all', 'filter_allowed_block_types_my_editor' ); … … 307 311 add_filter( 'block_editor_settings', array( $this, 'filter_set_block_editor_settings_post' ), 10, 2 ); 308 312 309 $settings = get_block_editor_settings( 'post-editor' ); 313 $post_editor_context = new WP_Block_Editor_Context( array( 'post' => get_post() ) ); 314 $settings = get_block_editor_settings( array(), $post_editor_context ); 310 315 311 316 remove_filter( 'block_editor_settings', array( $this, 'filter_set_block_editor_settings_post' ) ); … … 323 328 */ 324 329 function test_block_editor_rest_api_preload_no_paths() { 325 $ context = new WP_Block_Editor_Context();326 block_editor_rest_api_preload( array(), $ context );330 $editor_context = new WP_Block_Editor_Context(); 331 block_editor_rest_api_preload( array(), $editor_context ); 327 332 328 333 $after = implode( '', wp_scripts()->registered['wp-api-fetch']->extra['after'] ); … … 343 348 add_filter( 'block_editor_preload_paths', 'filter_remove_preload_paths', 10, 2 ); 344 349 345 $ context = new WP_Block_Editor_Context( array( 'post' => get_post() ) );350 $post_editor_context = new WP_Block_Editor_Context( array( 'post' => get_post() ) ); 346 351 block_editor_rest_api_preload( 347 352 array( 348 353 array( '/wp/v2/blocks', 'OPTIONS' ), 349 354 ), 350 $ context355 $post_editor_context 351 356 ); 352 357 … … 370 375 add_filter( 'block_editor_rest_api_preload_paths', 'filter_add_preload_paths', 10, 2 ); 371 376 372 $ context = new WP_Block_Editor_Context();377 $editor_context = new WP_Block_Editor_Context(); 373 378 block_editor_rest_api_preload( 374 379 array( 375 380 array( '/wp/v2/blocks', 'OPTIONS' ), 376 381 ), 377 $ context382 $editor_context 378 383 ); 379 384
Note: See TracChangeset
for help on using the changeset viewer.