File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "name" : " tests/hooked-block-error" ,
3+ "description" : " A block that throws an error because it tries to hook a block to itself." ,
4+ "blockHooks" : {
5+ "tests/hooked-block-error" : " before" ,
6+ "tests/other-block" : " after"
7+ }
8+ }
Original file line number Diff line number Diff line change 3131 "root" : " .wp-block-notice"
3232 },
3333 "blockHooks" : {
34- "core/post-content" : " before"
34+ "tests/before" : " before" ,
35+ "tests/after" : " after" ,
36+ "tests/first-child" : " firstChild" ,
37+ "tests/last-child" : " lastChild"
3538 },
3639 "supports" : {
3740 "align" : true ,
Original file line number Diff line number Diff line change @@ -645,8 +645,13 @@ public function test_block_registers_with_metadata_fixture() {
645645 'Block type should contain selectors from metadata. '
646646 );
647647 // @ticket 59346
648- $ this ->assertSame (
649- array ( 'core/post-content ' => 'before ' ),
648+ $ this ->assertSameSets (
649+ array (
650+ 'tests/before ' => 'before ' ,
651+ 'tests/after ' => 'after ' ,
652+ 'tests/first-child ' => 'first_child ' ,
653+ 'tests/last-child ' => 'last_child ' ,
654+ ),
650655 $ result ->block_hooks ,
651656 'Block type should contain block hooks from metadata. '
652657 );
@@ -1069,4 +1074,22 @@ public function test_register_block_style_name_without_spaces() {
10691074 $ actual = register_block_style ( 'core/query ' , $ block_styles );
10701075 $ this ->assertTrue ( $ actual );
10711076 }
1077+
1078+ /**
1079+ * @ticket 59346
1080+ *
1081+ * @covers ::register_block_type
1082+ *
1083+ * @expectedIncorrectUsage register_block_type_from_metadata
1084+ */
1085+ public function test_register_block_hooks_targeting_itself () {
1086+ $ block_type = register_block_type (
1087+ DIR_TESTDATA . '/blocks/hooked-block-error '
1088+ );
1089+
1090+ $ this ->assertSame (
1091+ array ( 'tests/other-block ' => 'after ' ),
1092+ $ block_type ->block_hooks
1093+ );
1094+ }
10721095}
You can’t perform that action at this time.
0 commit comments