public static function create(ObjectInterface $object, Property $property, int $code, \Throwable $previous) : HydrationException
{
return new HydrationException(sprintf('Could not hydrate the property "%s" of the object "%s" (class: %s).', $property->getName(), $object->getId(), get_class($object->getInstance())), $code, $previous);
}
public function testTestCreate() { $object = new SimpleObject('dummy', new \stdClass()); $property = new Property('foo', 'bar'); $code = 500; $previous = new \Error(); $exception = HydrationExceptionFactory::create($object, $property, $code, $previous); $this->assertEquals('Could not hydrate the property "foo" of the object "dummy" (class: stdClass).', $exception->getMessage()); $this->assertEquals($code, $exception->getCode()); $this->assertSame($previous, $exception->getPrevious()); }