diff --git a/tests/class-two-factor-core.php b/tests/class-two-factor-core.php index 594d119d..f3157b44 100644 --- a/tests/class-two-factor-core.php +++ b/tests/class-two-factor-core.php @@ -165,7 +165,9 @@ private function do_redirect_callable( $callback ) { private function reset_profile_errors() { $reflection = new ReflectionClass( Two_Factor_Core::class ); $prop = $reflection->getProperty( 'profile_errors' ); - $prop->setAccessible( true ); + if ( PHP_VERSION_ID < 80100 ) { + $prop->setAccessible( true ); + } $prop->setValue( null, array() ); } @@ -2371,7 +2373,9 @@ public function test_collect_auth_cookie_tokens() { // but capture the original value so it can be restored afterward. $reflection = new ReflectionClass( Two_Factor_Core::class ); $prop = $reflection->getProperty( 'password_auth_tokens' ); - $prop->setAccessible( true ); + if ( PHP_VERSION_ID < 80100 ) { + $prop->setAccessible( true ); + } $original_tokens = $prop->getValue( null ); try { diff --git a/tests/providers/class-two-factor-totp.php b/tests/providers/class-two-factor-totp.php index 50ea34f8..2b2f15d6 100644 --- a/tests/providers/class-two-factor-totp.php +++ b/tests/providers/class-two-factor-totp.php @@ -454,7 +454,9 @@ public function test_sha512_authenticate() { */ private function call_pad_secret( $secret, $length ) { $method = new ReflectionMethod( 'Two_Factor_Totp', 'pad_secret' ); - $method->setAccessible( true ); + if ( PHP_VERSION_ID < 80100 ) { + $method->setAccessible( true ); + } return $method->invoke( null, $secret, $length ); }