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 86e6fad commit d3323a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
36 changes: 0 additions & 36 deletions .tests/php/integration/includes/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* Test request file.
*
* @group request
* @expectedDeprecated hcaptcha_get_verify_output
*/
class RequestTest extends HCaptchaWPTestCase {

Expand Down Expand Up @@ -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().
*/
Expand Down
2 changes: 2 additions & 0 deletions src/php/includes/request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit d3323a8

Please sign in to comment.