Skip to content

Commit

Permalink
Fix integration tests deprecation issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
kagg-design committed Aug 24, 2024
1 parent ad995df commit 21d5a17
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .tests/php/integration/includes/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,22 +395,23 @@ public function test_hcaptcha_get_verify_output_not_validated_empty_POST(): void
public function test_hcaptcha_get_verify_output_with_deprecated_argument(): void {
$nonce_field_name = 'some nonce field';
$nonce_action_name = 'some nonce action';
$test_case = $this;

$this->prepare_hcaptcha_verify_post( $nonce_field_name, $nonce_action_name );

add_action(
'deprecated_argument_run',
static function ( $f, $m, $v ) use ( &$function_name, &$message, &$version ) {
static function ( $f, $m, $v ) use ( &$function_name, &$message, &$version, $test_case ) {
$function_name = $f;
$message = $m;
$version = $v;

unset( $test_case->caught_deprecated[ $f ] );
},
10,
PHP_INT_MAX,
3
);

add_action( 'deprecated_argument_trigger_error', '__return_false' );

self::assertNull( hcaptcha_get_verify_output( 'some', '', $nonce_field_name, $nonce_action_name ) );
self::assertSame( 1, did_action( 'deprecated_argument_run' ) );
self::assertSame( 'hcaptcha_get_verify_output', $function_name );
Expand Down

0 comments on commit 21d5a17

Please sign in to comment.