You are here

protected function ViewExecutableTest::getProtectedProperty in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/ViewExecutableTest.php \Drupal\Tests\views\Kernel\ViewExecutableTest::getProtectedProperty()
  2. 9 core/modules/views/tests/src/Kernel/ViewExecutableTest.php \Drupal\Tests\views\Kernel\ViewExecutableTest::getProtectedProperty()

Returns a protected property from a class instance.

Parameters

object $instance: The class instance to return the property from.

string $property: The name of the property to return.

Return value

mixed The instance property value.

File

core/modules/views/tests/src/Kernel/ViewExecutableTest.php, line 396

Class

ViewExecutableTest
Tests the ViewExecutable class.

Namespace

Drupal\Tests\views\Kernel

Code

protected function getProtectedProperty($instance, $property) {
  $reflection = new \ReflectionProperty($instance, $property);
  $reflection
    ->setAccessible(TRUE);
  return $reflection
    ->getValue($instance);
}