Changeset 58798 for trunk/tests/phpunit/tests/blocks/editor.php
- Timestamp:
- 07/24/2024 10:57:27 AM (17 months ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/blocks/editor.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/editor.php
r56682 r58798 721 721 ); 722 722 } 723 724 /** 725 * @ticket 61641 726 */ 727 public function test_get_block_editor_settings_block_bindings_sources() { 728 $block_editor_context = new WP_Block_Editor_Context(); 729 register_block_bindings_source( 730 'test/source-one', 731 array( 732 'label' => 'Source One', 733 'get_value_callback' => function () {}, 734 'uses_context' => array( 'postId' ), 735 ) 736 ); 737 register_block_bindings_source( 738 'test/source-two', 739 array( 740 'label' => 'Source Two', 741 'get_value_callback' => function () {}, 742 ) 743 ); 744 $settings = get_block_editor_settings( array(), $block_editor_context ); 745 $exposed_sources = $settings['blockBindingsSources']; 746 unregister_block_bindings_source( 'test/source-one' ); 747 unregister_block_bindings_source( 'test/source-two' ); 748 // It is expected to have 4 sources: the 2 registered sources in the test, and the 2 core sources. 749 $this->assertCount( 4, $exposed_sources ); 750 $source_one = $exposed_sources['test/source-one']; 751 $this->assertSame( 'Source One', $source_one['label'] ); 752 $this->assertSameSets( array( 'postId' ), $source_one['usesContext'] ); 753 $source_two = $exposed_sources['test/source-two']; 754 $this->assertSame( 'Source Two', $source_two['label'] ); 755 $this->assertArrayNotHasKey( 'usesContext', $source_two ); 756 } 723 757 }
Note: See TracChangeset
for help on using the changeset viewer.