You are here

protected static function MockHelperTrait::getProtectedValue in Mini site 8

Get protected value from the object.

Parameters

object $object: Object to set the value on.

string $property: Property name to get the value. Property should exists in the object.

Return value

mixed Protected property value.

File

tests/src/Traits/MockHelperTrait.php, line 66

Class

MockHelperTrait
Trait MockHelperTrait.

Namespace

Drupal\Tests\minisite\Traits

Code

protected static function getProtectedValue($object, $property) {
  $class = new \ReflectionClass(get_class($object));
  $property = $class
    ->getProperty($property);
  $property
    ->setAccessible(TRUE);
  return $property
    ->getValue($object);
}