Nelmio\Alice\Generator\Hydrator\Property\SymfonyPropertyAccessorHydratorTest::testThrowsInvalidArgumentExceptionIfInvalidTypeIsGiven PHP Method

testThrowsInvalidArgumentExceptionIfInvalidTypeIsGiven() public method

    public function testThrowsInvalidArgumentExceptionIfInvalidTypeIsGiven()
    {
        try {
            $object = new SimpleObject('dummy', new DummyWithDate());
            $property = new Property('immutableDateTime', 'bar');
            $this->hydrator->hydrate($object, $property, new GenerationContext());
            $this->fail('Expected exception to be thrown.');
        } catch (InvalidArgumentException $exception) {
            $this->assertEquals('Invalid value given for the property "immutableDateTime" of the object "dummy" (class: Nelmio\\Alice\\Entity\\DummyWithDate).', $exception->getMessage());
            $this->assertEquals(0, $exception->getCode());
            $this->assertNotNull($exception->getPrevious());
        }
    }