Kraken\Test\TUnit::setProtectedProperty PHP Method

setProtectedProperty() public method

Set protected property on a given object via reflection.
public setProtectedProperty ( object $object, string $property, mixed $value ) : object
$object object
$property string
$value mixed
return object
    public function setProtectedProperty($object, $property, $value)
    {
        $reflection = new ReflectionClass($object);
        $reflection_property = $reflection->getProperty($property);
        $reflection_property->setAccessible(true);
        $reflection_property->setValue($object, $value);
        return $object;
    }