Skip to content

Commit

Permalink
remove filters and expand doc block defnetion
Browse files Browse the repository at this point in the history
  • Loading branch information
kt-12 committed Jan 19, 2024
1 parent aafceda commit b0730c7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/phpunit/tests/blocks/wpBlockType.php
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,11 @@ public function test_variations_callback_happens_only_once() {

/**
* Test filter function for get_block_type_variations filter.
*
* @param array $variations Block variations before filter.
* @param WP_Block_Type $block_type Block type.
*
* @return array Block variations after filter.
*/
public function filter_test_variations( $variations, $block_type ) {
return array( array( 'name' => 'test1' ) );
Expand All @@ -611,7 +616,6 @@ public function test_get_block_type_variations_filter_with_variation_callback()
);

$obtained_variations = $block_type->variations; // access the variations.
remove_filter( 'get_block_type_variations', array( $this, 'filter_test_variations' ), 10 );

$this->assertSame( true, $callback_called, 'The callback should be called when the variations are accessed.' );
$this->assertSameSets( $obtained_variations, $expected_variations, 'The variations obtained from the callback should be filtered.' );
Expand All @@ -634,7 +638,6 @@ public function test_get_block_type_variations_filter_variations() {
);

$obtained_variations = $block_type->variations; // access the variations.
remove_filter( 'get_block_type_variations', array( $this, 'filter_test_variations' ), 10 );
$this->assertSameSets( $obtained_variations, $expected_variations, 'The variations that was initially set should be filtered.' );
}

Expand Down

0 comments on commit b0730c7

Please sign in to comment.