Nelmio\Alice\Generator\Hydrator\Property\SymfonyPropertyAccessorHydratorTest::testReturnsHydratedObject PHP Метод

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

    public function testReturnsHydratedObject()
    {
        $property = new Property('username', 'bob');
        $instance = new Dummy();
        $object = new SimpleObject('dummy', $instance);
        $accessorProphecy = $this->prophesize(PropertyAccessorInterface::class);
        $accessorProphecy->setValue($instance, 'username', 'bob')->willReturn(null);
        /** @var PropertyAccessorInterface $accessor */
        $accessor = $accessorProphecy->reveal();
        $hydrator = new SymfonyPropertyAccessorHydrator($accessor);
        $result = $hydrator->hydrate($object, $property, new GenerationContext());
        $this->assertEquals($object, $result);
        $accessorProphecy->setValue(Argument::cetera())->shouldHaveBeenCalledTimes(1);
    }