Changeset 60904
- Timestamp:
- 10/06/2025 11:29:14 AM (4 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
-
src/wp-includes/class-wp-block-bindings-registry.php (modified) (1 diff)
-
src/wp-includes/class-wp-block-pattern-categories-registry.php (modified) (1 diff)
-
src/wp-includes/class-wp-block-patterns-registry.php (modified) (1 diff)
-
src/wp-includes/class-wp-block-styles-registry.php (modified) (1 diff)
-
src/wp-includes/class-wp-block-templates-registry.php (modified) (1 diff)
-
tests/phpunit/tests/block-bindings/wpBlockBindingsRegistry.php (modified) (1 diff)
-
tests/phpunit/tests/block-pattern (added)
-
tests/phpunit/tests/block-pattern/wpBlockPatternCategoriesRegistry.php (added)
-
tests/phpunit/tests/block-templates/WpBlockTemplatesRegistry.php (modified) (1 diff)
-
tests/phpunit/tests/blocks/wpBlockPatternsRegistry.php (modified) (1 diff)
-
tests/phpunit/tests/blocks/wpBlockStylesRegistry.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-block-bindings-registry.php
r60804 r60904 250 250 * @since 6.5.0 251 251 * 252 * @param string $source_name The name of the source.252 * @param string|null $source_name The name of the source. 253 253 * @return bool `true` if the block bindings source is registered, `false` otherwise. 254 254 */ 255 255 public function is_registered( $source_name ) { 256 return isset( $ this->sources[ $source_name ] );256 return isset( $source_name, $this->sources[ $source_name ] ); 257 257 } 258 258 -
trunk/src/wp-includes/class-wp-block-pattern-categories-registry.php
r60275 r60904 139 139 * @since 5.5.0 140 140 * 141 * @param string $category_name Pattern category name including namespace.141 * @param string|null $category_name Pattern category name including namespace. 142 142 * @return bool True if the pattern category is registered, false otherwise. 143 143 */ 144 144 public function is_registered( $category_name ) { 145 return isset( $ this->registered_categories[ $category_name ] );145 return isset( $category_name, $this->registered_categories[ $category_name ] ); 146 146 } 147 147 -
trunk/src/wp-includes/class-wp-block-patterns-registry.php
r60804 r60904 239 239 * @since 5.5.0 240 240 * 241 * @param string $pattern_name Block pattern name including namespace.241 * @param string|null $pattern_name Block pattern name including namespace. 242 242 * @return bool True if the pattern is registered, false otherwise. 243 243 */ 244 244 public function is_registered( $pattern_name ) { 245 return isset( $ this->registered_patterns[ $pattern_name ] );245 return isset( $pattern_name, $this->registered_patterns[ $pattern_name ] ); 246 246 } 247 247 -
trunk/src/wp-includes/class-wp-block-styles-registry.php
r60275 r60904 182 182 * @since 5.3.0 183 183 * 184 * @param string $block_name Block type name including namespace.185 * @param string $block_style_name Block style name.184 * @param string|null $block_name Block type name including namespace. 185 * @param string|null $block_style_name Block style name. 186 186 * @return bool True if the block style is registered, false otherwise. 187 187 */ 188 188 public function is_registered( $block_name, $block_style_name ) { 189 return isset( $ this->registered_block_styles[ $block_name ][ $block_style_name ] );189 return isset( $block_name, $block_style_name, $this->registered_block_styles[ $block_name ][ $block_style_name ] ); 190 190 } 191 191 -
trunk/src/wp-includes/class-wp-block-templates-registry.php
r59742 r60904 205 205 * @since 6.7.0 206 206 * 207 * @param string $template_name Template name.207 * @param string|null $template_name Template name. 208 208 * @return bool True if the template is registered, false otherwise. 209 209 */ 210 210 public function is_registered( $template_name ) { 211 return isset( $t his->registered_templates[ $template_name ] );211 return isset( $template_name, $this->registered_templates[ $template_name ] ); 212 212 } 213 213 -
trunk/tests/phpunit/tests/block-bindings/wpBlockBindingsRegistry.php
r59080 r60904 345 345 $this->assertTrue( $result ); 346 346 } 347 348 /** 349 * Should return false when checking registration with a null source name. 350 * 351 * @ticket 63957 352 * 353 * @covers WP_Block_Bindings_Registry::is_registered 354 */ 355 public function test_is_registered_with_null_source_name() { 356 $result = $this->registry->is_registered( null ); 357 $this->assertFalse( $result ); 358 } 347 359 } -
trunk/tests/phpunit/tests/block-templates/WpBlockTemplatesRegistry.php
r59742 r60904 246 246 247 247 self::$registry->unregister( $template_name ); 248 } 249 250 /** 251 * @ticket 63957 252 * 253 * @covers ::is_registered 254 */ 255 public function test_is_registered_with_null_template_name() { 256 $this->assertFalse( self::$registry->is_registered( null ) ); 248 257 } 249 258 -
trunk/tests/phpunit/tests/blocks/wpBlockPatternsRegistry.php
r60729 r60904 696 696 } 697 697 } 698 699 /** 700 * @ticket 63957 701 */ 702 public function test_is_registered_with_null_pattern_name() { 703 $this->assertFalse( $this->registry->is_registered( null ) ); 704 } 698 705 } -
trunk/tests/phpunit/tests/blocks/wpBlockStylesRegistry.php
r58246 r60904 67 67 $this->assertTrue( $this->registry->is_registered( 'core/group', 'plain' ) ); 68 68 } 69 70 /** 71 * @ticket 63957 72 */ 73 public function test_is_registered_returns_false_for_null_block_name() { 74 $style_name = 'fancy-style'; 75 $this->assertFalse( 76 $this->registry->is_registered( null, $style_name ), 77 'Empty block name should return false.' 78 ); 79 } 80 81 /** 82 * @ticket 63957 83 */ 84 public function test_is_registered_returns_false_for_null_style_name() { 85 $block_name = 'core/paragraph'; 86 $this->assertFalse( 87 $this->registry->is_registered( $block_name, null ), 88 'Empty style name should return false.' 89 ); 90 } 91 92 /** 93 * @ticket 63957 94 */ 95 public function test_is_registered_returns_false_for_both_null_params() { 96 $this->assertFalse( 97 $this->registry->is_registered( null, null ), 98 'Both empty block and style name should return false.' 99 ); 100 } 69 101 }
Note: See TracChangeset
for help on using the changeset viewer.