Skip to content

Commit 99a6eb8

Browse files
committed
Fix: Add missing category to show_in_rest test abilities
Fixes test failures after merging trunk by adding the required `category` field to `test/not-show-in-rest` abilities. These abilities were introduced in PR WordPress#103 (show_in_rest feature) on trunk before the category requirement existed. Also fixes code bugs issues in WP_Ability class: - Add missing PHPDoc comment opener for show_in_rest property - Add missing PHPDoc comment opener for show_in_rest() method - Remove extra blank line in validate_args()
1 parent 474dcc9 commit 99a6eb8

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

includes/abilities-api/class-wp-ability.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class WP_Ability {
124124
*/
125125
protected $category;
126126

127+
/**
127128
* Whether to show the ability in the REST API.
128129
*
129130
* @since n.e.x.t
@@ -272,7 +273,6 @@ protected function prepare_properties( array $args ): array {
272273
);
273274
}
274275

275-
276276
// Set defaults for optional args.
277277
$args['annotations'] = wp_parse_args(
278278
$args['annotations'] ?? array(),
@@ -371,6 +371,7 @@ public function get_category(): string {
371371
return $this->category;
372372
}
373373

374+
/**
374375
* Checks whether the ability should be shown in the REST API.
375376
*
376377
* @since n.e.x.t

tests/unit/rest-api/wpRestAbilitiesListController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ private function register_test_abilities(): void {
225225
array(
226226
'label' => 'Hidden from REST',
227227
'description' => 'It does not show in REST.',
228+
'category' => 'general',
228229
'execute_callback' => static function (): int {
229230
return 0;
230231
},

tests/unit/rest-api/wpRestAbilitiesRunController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ private function register_test_abilities(): void {
249249
array(
250250
'label' => 'Hidden from REST',
251251
'description' => 'It does not show in REST.',
252+
'category' => 'general',
252253
'execute_callback' => static function (): int {
253254
return 0;
254255
},

0 commit comments

Comments
 (0)