File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
tests/phpunit/tests/blocks Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,13 @@ class Tests_Blocks_ApplyBlockHooksToContentFromPostObject extends WP_UnitTestCas
27
27
*/
28
28
protected static $ post_with_ignored_hooked_block ;
29
29
30
+ /**
31
+ * Post object.
32
+ *
33
+ * @var WP_Post
34
+ */
35
+ protected static $ post_with_non_block_content ;
36
+
30
37
/**
31
38
*
32
39
* Set up.
@@ -55,6 +62,15 @@ public static function wpSetUpBeforeClass() {
55
62
)
56
63
);
57
64
65
+ self ::$ post_with_non_block_content = self ::factory ()->post ->create_and_get (
66
+ array (
67
+ 'post_type ' => 'post ' ,
68
+ 'post_status ' => 'publish ' ,
69
+ 'post_title ' => 'Test Post ' ,
70
+ 'post_content ' => '<h1>Hello World!</h1> ' ,
71
+ )
72
+ );
73
+
58
74
register_block_type (
59
75
'tests/hooked-block ' ,
60
76
array (
@@ -113,4 +129,16 @@ public function test_apply_block_hooks_to_content_from_post_object_respects_igno
113
129
);
114
130
$ this ->assertSame ( $ expected , $ actual );
115
131
}
132
+
133
+ /**
134
+ * @ticket 62716
135
+ */
136
+ public function test_apply_block_hooks_to_content_from_post_object_preserves_non_block_content () {
137
+ $ actual = apply_block_hooks_to_content_from_post_object (
138
+ self ::$ post_with_non_block_content ->post_content ,
139
+ self ::$ post_with_non_block_content ,
140
+ 'insert_hooked_blocks '
141
+ );
142
+ $ this ->assertSame ( self ::$ post_with_non_block_content ->post_content , $ actual );
143
+ }
116
144
}
You can’t perform that action at this time.
0 commit comments