protected static function MockHelperTrait::setProtectedValue in Mini site 8
Set protected property value.
Parameters
object $object: Object to set the value on.
string $property: Property name to set the value. Property should exists in the object.
mixed $value: Value to set to the property.
File
- tests/
src/ Traits/ MockHelperTrait.php, line 47
Class
- MockHelperTrait
- Trait MockHelperTrait.
Namespace
Drupal\Tests\minisite\TraitsCode
protected static function setProtectedValue($object, $property, $value) {
$class = new \ReflectionClass(get_class($object));
$property = $class
->getProperty($property);
$property
->setAccessible(TRUE);
$property
->setValue($object, $value);
}