Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b020b06
Update template utils to accommodate first_child and last_child hooke…
tjcafferkey Jun 20, 2024
6b78fcd
Insert ignoredHookedBlocks postmeta via rest_pre_insert_wp_template_p…
tjcafferkey Jun 24, 2024
1dccc50
Update comment
tjcafferkey Jun 24, 2024
87462d5
Update tests
tjcafferkey Jun 25, 2024
8978b80
Add assertion, change anchor block
ockham Jun 25, 2024
d5f6c30
Update tests
tjcafferkey Jun 26, 2024
0ed6e89
Remove duplciate get_post_meta call
tjcafferkey Jun 26, 2024
83040a6
Build correct context for the block hooks API when the post type is a…
tjcafferkey Jun 26, 2024
5e4876c
Test coverage
tjcafferkey Jun 27, 2024
1e3e362
Ensure that for template files _inject_theme_attribute_in_template_pa…
tjcafferkey Jun 27, 2024
f4062ad
Update comments
tjcafferkey Jun 28, 2024
6c95919
Remove update_ignored_hooked_blocks_postmeta from rest_pre_insert_wp_…
ockham Jul 1, 2024
0ceb66b
Add extract_serialized_parent_block helper
ockham Jul 1, 2024
5489657
Handle template-part first_child/last_child insertion in inject_ignor…
ockham Jul 1, 2024
46c73e0
Revert changes to update_ignored_hooked_blocks_postmeta
ockham Jul 1, 2024
9fa3ee7
Add note about _make_mock_parsed_block being internal use only
ockham Jul 1, 2024
e676f4b
Add test coverage
ockham Jul 1, 2024
560dcce
Revert changes to updateIgnoredHookedBlocksPostMeta test
ockham Jul 1, 2024
58c6689
Clean up post meta
ockham Jul 1, 2024
e7db202
Start fixing tests
ockham Jul 1, 2024
adacaae
Polish test
ockham Jul 1, 2024
b3377b3
Fix other tests
ockham Jul 1, 2024
97d4624
Add ticket numbers
ockham Jul 1, 2024
f324f96
Single quotes
ockham Jul 1, 2024
83cfa72
Polish other tests
ockham Jul 1, 2024
1ddf9d3
Add PHPDoc descriptions to _make_mock_parsed_block
ockham Jul 1, 2024
40464ce
Wrap a line
ockham Jul 1, 2024
5df1860
Revert "Wrap a line"
ockham Jul 1, 2024
1517c44
Rewrite to remove _make_mock_parsed_block
ockham Jul 1, 2024
b679595
Variable names
ockham Jul 1, 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
Polish other tests
  • Loading branch information
ockham committed Jul 2, 2024
commit 83cfa726fdee0ffa5a4488004c9f18d8502f2342
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,35 @@ public function test_hooked_block_types_filter_with_newly_created_template() {

inject_ignored_hooked_blocks_metadata_attributes( $changes );

$args = $action->get_args();
$anchor_block_type = end( $args )[2];
$context = end( $args )[3];
$args = $action->get_args();
$relative_positions = array_column( $args, 1 );
$anchor_block_types = array_column( $args, 2 );
$contexts = array_column( $args, 3 );

$this->assertSame( 'tests/anchor-block', $anchor_block_type );
$this->assertSame(
array(
'before',
'after',
),
$relative_positions,
'The relative positions passed to the hooked_block_types filter are incorrect.'
);

$this->assertInstanceOf( 'WP_Block_Template', $context );
$this->assertSame(
array(
'tests/anchor-block',
'tests/anchor-block',
),
$anchor_block_types,
'The anchor block types passed to the hooked_block_types filter are incorrect.'
);

$context = $contexts[0];
$this->assertSame(
array_fill( 0, count( $contexts ), $context ),
$contexts,
'The context passed to the hooked_block_types filter should be the same for all calls.'
);
$this->assertSame(
$changes->post_type,
$context->type,
Expand Down Expand Up @@ -176,14 +197,35 @@ public function test_hooked_block_types_filter_with_existing_template_file() {

inject_ignored_hooked_blocks_metadata_attributes( $changes );

$args = $action->get_args();
$anchor_block_type = end( $args )[2];
$context = end( $args )[3];
$args = $action->get_args();
$relative_positions = array_column( $args, 1 );
$anchor_block_types = array_column( $args, 2 );
$contexts = array_column( $args, 3 );

$this->assertSame( 'tests/anchor-block', $anchor_block_type );
$this->assertSame(
array(
'before',
'after',
),
$relative_positions,
'The relative positions passed to the hooked_block_types filter are incorrect.'
);

$this->assertInstanceOf( 'WP_Block_Template', $context );
$this->assertSame(
array(
'tests/anchor-block',
'tests/anchor-block',
),
$anchor_block_types,
'The anchor block types passed to the hooked_block_types filter are incorrect.'
);

$context = $contexts[0];
$this->assertSame(
array_fill( 0, count( $contexts ), $context ),
$contexts,
'The context passed to the hooked_block_types filter should be the same for all calls.'
);
$this->assertSame(
$changes->post_name,
$context->slug,
Expand Down Expand Up @@ -330,14 +372,35 @@ public function test_hooked_block_types_filter_with_existing_template_post() {

inject_ignored_hooked_blocks_metadata_attributes( $changes );

$args = $action->get_args();
$anchor_block_type = end( $args )[2];
$context = end( $args )[3];
$args = $action->get_args();
$relative_positions = array_column( $args, 1 );
$anchor_block_types = array_column( $args, 2 );
$contexts = array_column( $args, 3 );

$this->assertSame( 'tests/anchor-block', $anchor_block_type );
$this->assertSame(
array(
'before',
'after',
),
$relative_positions,
'The relative positions passed to the hooked_block_types filter are incorrect.'
);

$this->assertInstanceOf( 'WP_Block_Template', $context );
$this->assertSame(
array(
'tests/anchor-block',
'tests/anchor-block',
),
$anchor_block_types,
'The anchor block types passed to the hooked_block_types filter are incorrect.'
);

$context = $contexts[0];
$this->assertSame(
array_fill( 0, count( $contexts ), $context ),
$contexts,
'The context passed to the hooked_block_types filter should be the same for all calls.'
);
$this->assertSame(
$changes->post_name,
$context->slug,
Expand Down