Skip to content
Closed
Changes from 1 commit
Commits
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
Add ticket PHPDoc
  • Loading branch information
ockham committed Nov 28, 2023
commit bef23016d87e37f5c0d608326ae5045eb27c2c36
22 changes: 22 additions & 0 deletions tests/phpunit/tests/blocks/getHookedBlockMarkup
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
class Tests_Blocks_GetHookedBlockMarkup extends WP_UnitTestCase
{
/**
* @ticket 59646
*
* @covers ::get_hooked_block_markup
*/
public function test_get_hooked_block_markup() {
Expand All @@ -24,4 +26,24 @@ class Tests_Blocks_GetHookedBlockMarkup extends WP_UnitTestCase
$this->assertSame( array( 'tests/hooked-block' ), $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] );
$this->assertSame( '<!-- wp:tests/hooked-block /-->', $actual );
}

/**
* @ticket 59646
*
* @covers ::get_hooked_block_markup
*/
public function test_get_hooked_block_markup_if_block_is_already_hooked() {
$anchor_block = array(
'blockName' => 'tests/anchor-block',
'attrs' => array(
'metadata' => array(
'ignoredHookedBlocks' => array( 'tests/hooked-block' ),
),
)
);

$actual = get_hooked_block_markup( $anchor_block, 'tests/hooked-block' );
$this->assertSame( array( 'tests/hooked-block' ), $anchor_block['attrs']['metadata']['ignoredHookedBlocks'] );
$this->assertSame( '', $actual );
}
}