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

testThrowsNoPropertyExceptionIfPropertyCouldNotBeFound() public method

    public function testThrowsNoPropertyExceptionIfPropertyCouldNotBeFound()
    {
        try {
            $object = new SimpleObject('dummy', new \Nelmio\Alice\Dummy());
            $property = new Property('foo', 'bar');
            $this->hydrator->hydrate($object, $property, new GenerationContext());
            $this->fail('Expected exception to be thrown.');
        } catch (NoSuchPropertyException $exception) {
            $this->assertEquals('Could not hydrate the property "foo" of the object "dummy" (class: Nelmio\\Alice\\Dummy).', $exception->getMessage());
            $this->assertEquals(0, $exception->getCode());
            $this->assertNotNull($exception->getPrevious());
        }
    }