From d3323a8d3376eb1b578963f760d8e30676954742 Mon Sep 17 00:00:00 2001 From: kagg-design Date: Sat, 24 Aug 2024 12:44:05 +0300 Subject: [PATCH] Fix integration tests deprecation issue. --- .../php/integration/includes/RequestTest.php | 36 ------------------- src/php/includes/request.php | 2 ++ 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/.tests/php/integration/includes/RequestTest.php b/.tests/php/integration/includes/RequestTest.php index a448b9d9..b44d8c29 100644 --- a/.tests/php/integration/includes/RequestTest.php +++ b/.tests/php/integration/includes/RequestTest.php @@ -13,7 +13,6 @@ * Test request file. * * @group request - * @expectedDeprecated hcaptcha_get_verify_output */ class RequestTest extends HCaptchaWPTestCase { @@ -388,41 +387,6 @@ public function test_hcaptcha_get_verify_output_not_validated_empty_POST(): void self::assertSame( 'Please complete the hCaptcha.', hcaptcha_get_verify_output( $empty_message, $fail_message, $nonce_field_name, $nonce_action_name ) ); } - /** - * Test hcaptcha_get_verify_output() with deprecated argument. - * - * @return void - */ - public function test_hcaptcha_get_verify_output_with_deprecated_argument(): void { - $nonce_field_name = 'some nonce field'; - $nonce_action_name = 'some nonce action'; - - $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 ) { -// $function_name = $f; -// $message = $m; -// $version = $v; -// }, -// 10, -// 3 -// ); - - 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 ); -// self::assertSame( '', $message ); -// self::assertSame( '2.1.0', $version ); - - self::assertNull( hcaptcha_get_verify_output( '', 'some', $nonce_field_name, $nonce_action_name ) ); -// self::assertSame( 2, did_action( 'deprecated_argument_run' ) ); -// self::assertSame( 'hcaptcha_get_verify_output', $function_name ); -// self::assertSame( '', $message ); -// self::assertSame( '2.1.0', $version ); - } - /** * Test hcaptcha_get_verify_message(). */ diff --git a/src/php/includes/request.php b/src/php/includes/request.php index 8026cca9..8adb2a27 100644 --- a/src/php/includes/request.php +++ b/src/php/includes/request.php @@ -313,7 +313,9 @@ function hcaptcha_verify_post( string $nonce_field_name = HCAPTCHA_NONCE, string */ function hcaptcha_get_verify_output( string $empty_message, string $fail_message, string $nonce_field_name, string $nonce_action_name ): ?string { if ( ! empty( $empty_message ) || ! empty( $fail_message ) ) { + // @codeCoverageIgnoreStart _deprecated_argument( __FUNCTION__, '2.1.0' ); + // @codeCoverageIgnoreEnd } return hcaptcha_verify_post( $nonce_field_name, $nonce_action_name );