Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/abilities-api/class-wp-abilities-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function register( string $name, array $args ): ?WP_Ability {
/**
* Filters the ability arguments before they are validated and used to instantiate the ability.
*
* @since n.e.x.t
* @since 0.2.0
*
* @param array<string,mixed> $args The arguments used to instantiate the ability.
* @param string $name The name of the ability, with its namespace.
Expand Down
10 changes: 5 additions & 5 deletions includes/abilities-api/class-wp-ability.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ protected function validate_input( $input = null ) {
*
* The input is validated against the input schema before it is passed to to permission callback.
*
* @since N.E.X.T
* @since 0.2.0
*
* @param mixed $input Optional. The input data for permission checking. Default `null`.
* @return bool|\WP_Error Whether the ability has the necessary permission.
Expand All @@ -335,7 +335,7 @@ public function check_permissions( $input = null ) {
*
* The input is validated against the input schema before it is passed to to permission callback.
*
* @deprecated N.E.X.T Use check_permissions() instead.
* @deprecated 0.2.0 Use check_permissions() instead.
* @see WP_Ability::check_permissions()
*
* @since 0.1.0
Expand All @@ -344,7 +344,7 @@ public function check_permissions( $input = null ) {
* @return bool|\WP_Error Whether the ability has the necessary permission.
*/
public function has_permission( $input = null ) {
_deprecated_function( __METHOD__, 'N.E.X.T', 'WP_Ability::check_permissions()' );
_deprecated_function( __METHOD__, '0.2.0', 'WP_Ability::check_permissions()' );
return $this->check_permissions( $input );
}

Expand Down Expand Up @@ -436,7 +436,7 @@ public function execute( $input = null ) {
/**
* Fires before an ability gets executed.
*
* @since n.e.x.t
* @since 0.2.0
*
* @param string $ability_name The name of the ability.
* @param mixed $input The input data for the ability.
Expand All @@ -456,7 +456,7 @@ public function execute( $input = null ) {
/**
* Fires immediately after an ability finished executing.
*
* @since n.e.x.t
* @since 0.2.0
*
* @param string $ability_name The name of the ability.
* @param mixed $input The input data for the ability.
Expand Down
25 changes: 14 additions & 11 deletions tests/unit/abilities-api/wpAbility.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function set_up(): void {
*/
public function data_execute_input() {
return array(
'null input' => array(
'null input' => array(
array(
'type' => array( 'null', 'integer' ),
'description' => 'The null or integer to convert to integer.',
Expand All @@ -52,7 +52,7 @@ static function ( $input ): int {
null,
0,
),
'boolean input' => array(
'boolean input' => array(
array(
'type' => 'boolean',
'description' => 'The boolean to convert to integer.',
Expand All @@ -64,7 +64,7 @@ static function ( bool $input ): int {
true,
1,
),
'integer input' => array(
'integer input' => array(
array(
'type' => 'integer',
'description' => 'The integer to add 5 to.',
Expand All @@ -76,7 +76,7 @@ static function ( int $input ): int {
2,
7,
),
'number input' => array(
'number input' => array(
array(
'type' => 'number',
'description' => 'The floating number to round.',
Expand All @@ -88,7 +88,7 @@ static function ( float $input ): int {
2.7,
3,
),
'string input' => array(
'string input' => array(
array(
'type' => 'string',
'description' => 'The string to measure the length of.',
Expand All @@ -100,7 +100,7 @@ static function ( string $input ): int {
'Hello world!',
12,
),
'object input' => array(
'object input' => array(
array(
'type' => 'object',
'description' => 'An object containing two numbers to add.',
Expand All @@ -117,24 +117,27 @@ static function ( string $input ): int {
),
),
'additionalProperties' => false,
),
),
static function ( array $input ): int {
return $input['a'] + $input['b'];
},
array( 'a' => 2, 'b' => 3 ),
array(
'a' => 2,
'b' => 3,
),
5,
),
'array input' => array(
'array input' => array(
array(
'type' => 'array',
'description' => 'An array containing two numbers to add.',
'required' => true,
'minItems' => 2,
'maxItems' => 2,
'maxItems' => 2,
'items' => array(
'type' => 'integer',
),
),
),
static function ( array $input ): int {
return $input[0] + $input[1];
},
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/rest-api/wpRestAbilitiesListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public function test_pagination_links(): void {
$request->set_param( 'page', 1 );
$response = $this->server->dispatch( $request );

$headers = $response->get_headers();
$headers = $response->get_headers();
$link_header = $headers['Link'] ?? '';

// Parse Link header for rel="next" and rel="prev"
Expand All @@ -311,7 +311,7 @@ public function test_pagination_links(): void {
$request->set_param( 'page', 3 );
$response = $this->server->dispatch( $request );

$headers = $response->get_headers();
$headers = $response->get_headers();
$link_header = $headers['Link'] ?? '';

$this->assertStringContainsString( 'rel="next"', $link_header );
Expand All @@ -323,7 +323,7 @@ public function test_pagination_links(): void {
$request->set_param( 'page', $last_page );
$response = $this->server->dispatch( $request );

$headers = $response->get_headers();
$headers = $response->get_headers();
$link_header = $headers['Link'] ?? '';

$this->assertStringNotContainsString( 'rel="next"', $link_header );
Expand Down