hasProperty($property) && $reflector->getParentClass() && $reflector->getParentClass()->hasProperty($property) ) { $reflector = $reflector->getParentClass(); } $property = $reflector->getProperty($property); $property->setAccessible(true); return $property; } /** * @param $class * @param $property * @param $value * @return $this * @throws ReflectionException */ protected function setPrivateProperty($class, $property, $value) { $property = $this->getPrivateProperty($class, $property); $property->setValue($class, $value); return $this; } /** * @param $className * @param array $methods * @return MockObject */ protected function getClassMock($className, array $methods = []) { return $this->getMockBuilder($className) ->disableOriginalConstructor() ->setMethods($methods) ->getMock(); } }