Skip to content

Commit 78b010b

Browse files
committed
tests: gate ReflectionProperty::setAccessible()
1 parent 941cc8b commit 78b010b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/phpunit/tests/ai-client/wpAiClientPrompt.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public function test_returns_error_builder_when_ai_not_supported() {
4343
// Check the $error prop is a real WP_Error with the expected message.
4444
$reflection = new ReflectionClass( $builder );
4545
$error_prop = $reflection->getProperty( 'error' );
46-
$error_prop->setAccessible( true );
46+
if ( PHP_VERSION_ID < 80100 ) {
47+
$error_prop->setAccessible( true );
48+
}
4749
$error = $error_prop->getValue( $builder );
4850

4951
$this->assertInstanceOf( WP_Error::class, $error );

0 commit comments

Comments
 (0)