Nelmio\Alice\Throwable\Exception\Generator\Hydrator\HydrationExceptionFactoryTest::testTestCreateForInvalidProperty PHP Метод

testTestCreateForInvalidProperty() публичный Метод

    public function testTestCreateForInvalidProperty()
    {
        $object = new SimpleObject('dummy', new \stdClass());
        $property = new Property('foo', 'bar');
        $exception = HydrationExceptionFactory::createForInvalidProperty($object, $property);
        $this->assertEquals('Invalid value given for the property "foo" of the object "dummy" (class: stdClass).', $exception->getMessage());
        $this->assertEquals(0, $exception->getCode());
        $this->assertNull($exception->getPrevious());
        $code = 500;
        $previous = new \Error();
        $exception = HydrationExceptionFactory::createForInvalidProperty($object, $property, $code, $previous);
        $this->assertEquals('Invalid value given for the property "foo" of the object "dummy" (class: stdClass).', $exception->getMessage());
        $this->assertEquals($code, $exception->getCode());
        $this->assertSame($previous, $exception->getPrevious());
    }