@@ -34,7 +34,7 @@ public function set_up(): void {
3434 add_action (
3535 'wp_abilities_api_categories_init ' ,
3636 function () {
37- if ( ! WP_Ability_Categories_Registry:: get_instance ()-> is_registered ( 'math ' ) ) {
37+ if ( ! wp_has_ability_category ( 'math ' ) ) {
3838 wp_register_ability_category (
3939 'math ' ,
4040 array (
@@ -471,6 +471,34 @@ public function test_get_existing_ability() {
471471 );
472472 }
473473
474+ /**
475+ * Tests checking if an ability is registered.
476+ *
477+ * @ticket 64098
478+ */
479+ public function test_has_registered_ability () {
480+ do_action ( 'wp_abilities_api_init ' );
481+
482+ wp_register_ability ( self ::$ test_ability_name , self ::$ test_ability_args );
483+
484+ $ result = wp_has_ability ( self ::$ test_ability_name );
485+
486+ $ this ->assertTrue ( $ result );
487+ }
488+
489+ /**
490+ * Tests checking if a non-existent ability is registered.
491+ *
492+ * @ticket 64098
493+ */
494+ public function test_has_registered_nonexistent_abi () {
495+ do_action ( 'wp_abilities_api_init ' );
496+
497+ $ result = wp_has_ability ( 'test/non-existent ' );
498+
499+ $ this ->assertFalse ( $ result );
500+ }
501+
474502 /**
475503 * Tests retrieving all registered abilities.
476504 *
@@ -513,7 +541,7 @@ public function test_register_ability_nonexistent_category(): void {
513541
514542 // Ensure category doesn't exist - test should fail if it does.
515543 $ this ->assertFalse (
516- WP_Ability_Categories_Registry:: get_instance ()-> is_registered ( 'nonexistent ' ),
544+ wp_has_ability_category ( 'nonexistent ' ),
517545 'The nonexistent category should not be registered - test isolation may be broken '
518546 );
519547
0 commit comments