public function testHydratesObjectWithTheGivenProperties()
{
$object = new SimpleObject('dummy', new \stdClass());
$set = ResolvedFixtureSetFactory::create(null, $fixtures = (new FixtureBag())->with(new SimpleFixture('dummy', \stdClass::class, new SpecificationBag(null, (new PropertyBag())->with($username = new Property('username', 'Bob'))->with($group = new Property('group', 'Badass')), new MethodCallBag()))));
$context = new GenerationContext();
$context->markIsResolvingFixture('foo');
$hydratorProphecy = $this->prophesize(PropertyHydratorInterface::class);
$newInstance = new \stdClass();
$newInstance->username = 'Bob';
$newObject = $object->withInstance($newInstance);
$hydratorProphecy->hydrate($object, $username, $context)->willReturn($newObject);
$secondNewInstance = clone $newInstance;
$secondNewInstance->group = 'Badass';
$secondNewObject = $object->withInstance($secondNewInstance);
$hydratorProphecy->hydrate($newObject, $group, $context)->willReturn($secondNewObject);
/** @var PropertyHydratorInterface $hydrator */
$hydrator = $hydratorProphecy->reveal();
$expected = new ResolvedFixtureSet(new ParameterBag(), $fixtures, new ObjectBag(['dummy' => $secondNewObject]));
$hydrator = new SimpleHydrator($hydrator, new FakeValueResolver());
$actual = $hydrator->hydrate($object, $set, $context);
$this->assertEquals($expected, $actual);
$hydratorProphecy->hydrate(Argument::cetera())->shouldHaveBeenCalledTimes(2);
}