public function testIfTheReferenceRefersToAnInstantiatedFixtureAndRequiresToBeCompleteThenGenerateIt()
{
$value = new FixtureReferenceValue('dummy');
$fixture = new FakeFixture();
$set = ResolvedFixtureSetFactory::create(null, $fixtures = (new FixtureBag())->with($referredFixture = new SimpleFixture('dummy', 'Dummy', SpecificationBagFactory::create())), (new ObjectBag())->with(new SimpleObject('dummy', $expectedInstance = new \stdClass())));
$scope = [];
$context = new GenerationContext();
$context->markAsNeedsCompleteGeneration();
$generatorContext = new GenerationContext();
$generatorContext->markIsResolvingFixture('dummy');
$generatorContext->markAsNeedsCompleteGeneration();
$generatorProphecy = $this->prophesize(ObjectGeneratorInterface::class);
$generatorProphecy->generate($referredFixture, $set, $generatorContext)->willReturn($objects = new ObjectBag(['dummy' => $expectedInstance = StdClassFactory::create(['complete' => true])]));
/** @var ObjectGeneratorInterface $generator */
$generator = $generatorProphecy->reveal();
$expected = new ResolvedValueWithFixtureSet($expectedInstance, ResolvedFixtureSetFactory::create(null, $fixtures, $objects));
$resolver = new FixtureReferenceResolver($generator);
$actual = $resolver->resolve($value, $fixture, $set, $scope, $context);
$this->assertEquals($expected, $actual);
$this->assertEquals($context, $generatorContext);
$generatorProphecy->generate(Argument::cetera())->shouldHaveBeenCalledTimes(1);
}