Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b5aaa44
Don't set ignoredHookedBlocks metadata upon read
ockham Feb 12, 2024
2e28810
Don't pass anchor_block by reference
ockham Feb 12, 2024
40fa3fb
Update PHPDoc
ockham Feb 12, 2024
1f0d087
Add new set_ignored_hooked_blocks_metadata() function
ockham Feb 12, 2024
c434d75
Whitespace
ockham Feb 12, 2024
b63d367
Fix first batch of unit tests
ockham Feb 12, 2024
36c0fc3
Fix remaining unit tests
ockham Feb 12, 2024
2358241
There can never be enough callbacks
ockham Feb 12, 2024
0330473
Tweak set_ignored_hooked_blocks_metadata to match callback signature
ockham Feb 12, 2024
e6eea6e
Wire it all up
ockham Feb 12, 2024
eb1daa1
Whitespace
ockham Feb 13, 2024
d057ece
Bail early
ockham Feb 13, 2024
ab6a8c9
Actually update post
ockham Feb 13, 2024
998147f
Use correct action
ockham Feb 13, 2024
1296344
Add action for template parts
ockham Feb 13, 2024
27724fc
Add note on action vs filter
ockham Feb 13, 2024
012004b
Clarify comment
ockham Feb 13, 2024
27a2ec8
Fix more unit tests
ockham Feb 13, 2024
12ccd0d
Start adding test coverage for set_ignored_hooked_blocks_metadata
ockham Feb 13, 2024
1128b5f
Add more test coverage and a small fix
ockham Feb 13, 2024
5817b49
Add test coverage for hooked block added by filter
ockham Feb 13, 2024
60b2732
Add test to cover context-aware filter
ockham Feb 13, 2024
61847cb
Remove obsolete comment about post_filtered_content
ockham Feb 13, 2024
712260f
Move set_ignored_hooked_blocks_metadata function definition below ins…
ockham Feb 13, 2024
7c7f01e
Inline get_hooked_block_markup
ockham Feb 13, 2024
f4f856b
Coding Standards in test
ockham Feb 13, 2024
7d43f21
Add test coverage to verify hooked blocks aren't added if ignored
ockham Feb 13, 2024
3c9aa4b
Move set_ignored_hooked_blocks_metadata_upon_rest_insert to block-tem…
ockham Feb 13, 2024
51832fe
Rename to inject_ignored_hooked_blocks_metadata_attributes
ockham Feb 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix remaining unit tests
  • Loading branch information
ockham committed Feb 13, 2024
commit 36c0fc3cab73f010cc7629714cd5f409bfc44364
9 changes: 6 additions & 3 deletions tests/phpunit/tests/blocks/getHookedBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public function test_get_hooked_blocks_matches_found() {
/**
* @ticket 59313
* @ticket 60008
* @ticket 60506
*
* @covers ::get_hooked_blocks
* @covers ::get_block_file_template
Expand All @@ -150,7 +151,7 @@ public function test_loading_template_with_hooked_blocks() {
$template->content
);
$this->assertStringContainsString(
'<!-- wp:post-content {"layout":{"type":"constrained"},"metadata":{"ignoredHookedBlocks":["tests/hooked-after"]}} /-->'
'<!-- wp:post-content {"layout":{"type":"constrained"}} /-->'
. '<!-- wp:tests/hooked-after /-->',
$template->content
);
Expand All @@ -167,6 +168,7 @@ public function test_loading_template_with_hooked_blocks() {
/**
* @ticket 59313
* @ticket 60008
* @ticket 60506
*
* @covers ::get_hooked_blocks
* @covers ::get_block_file_template
Expand All @@ -178,7 +180,7 @@ public function test_loading_template_part_with_hooked_blocks() {

$this->assertStringContainsString(
'<!-- wp:tests/hooked-before /-->'
. '<!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"},"metadata":{"ignoredHookedBlocks":["tests/hooked-before"]}} /-->',
. '<!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"}} /-->',
$template->content
);
$this->assertStringNotContainsString(
Expand All @@ -198,6 +200,7 @@ public function test_loading_template_part_with_hooked_blocks() {
/**
* @ticket 59313
* @ticket 60008
* @ticket 60506
*
* @covers ::get_hooked_blocks
* @covers WP_Block_Patterns_Registry::get_registered
Expand All @@ -218,7 +221,7 @@ public function test_loading_pattern_with_hooked_blocks() {
$pattern['content']
);
$this->assertStringContainsString(
'<!-- wp:comments {"metadata":{"ignoredHookedBlocks":["tests/hooked-first-child"]}} -->'
'<!-- wp:comments -->'
. '<div class="wp-block-comments">'
. '<!-- wp:tests/hooked-first-child /-->',
str_replace( array( "\n", "\t" ), '', $pattern['content'] )
Expand Down