You are here

protected function ViewExecutableTest::getProtectedProperty in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/ViewExecutableTest.php \Drupal\Tests\views\Kernel\ViewExecutableTest::getProtectedProperty()
  2. 10 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.

1 call to ViewExecutableTest::getProtectedProperty()
ViewExecutableTest::assertViewDestroy in core/modules/views/tests/src/Kernel/ViewExecutableTest.php
Asserts that expected view properties have been unset by destroy().

File

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

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);
}