mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic test coverage for insert_hooked_blocks
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* Tests for the insert_hooked_blocks function. | ||
* | ||
* @package WordPress | ||
* @subpackage Blocks | ||
* | ||
* @since 6.5.0 | ||
* | ||
* @group blocks | ||
* @group block-hooks | ||
*/ | ||
class Tests_Blocks_InsertHookedBlocks extends WP_UnitTestCase { | ||
/** | ||
* @covers ::insert_hooked_blocks | ||
*/ | ||
public function test_insert_hooked_blocks() { | ||
$anchor_block_name = 'tests/anchor-block'; | ||
$anchor_block = array( | ||
'blockName' => $anchor_block_name, | ||
); | ||
|
||
// Maybe move to class level and include other relative positions? | ||
// And/or data provider? | ||
$hooked_blocks = array( | ||
$anchor_block_name => array( | ||
'after' => array( 'tests/hooked-before' ), | ||
) | ||
); | ||
|
||
$actual = insert_hooked_blocks( $anchor_block, 'after', $hooked_blocks, array() ); | ||
$this->assertSame( '<!-- wp:tests/hooked-before /-->', $actual ); | ||
} | ||
} |