public function testThrowsAnExceptionIfResolvedReferenceHasNoSuchProperty()
{
try {
$value = new FixturePropertyValue($reference = new FakeValue(), $property = 'prop');
$instance = new \stdClass();
$instance->prop = 'foo';
$set = ResolvedFixtureSetFactory::create();
$valueResolverProphecy = $this->prophesize(ValueResolverInterface::class);
$valueResolverProphecy->resolve(Argument::cetera())->willReturn(new ResolvedValueWithFixtureSet(new \stdClass(), $set));
/** @var ValueResolverInterface $valueResolver */
$valueResolver = $valueResolverProphecy->reveal();
$resolver = new FixturePropertyReferenceResolver(PropertyAccess::createPropertyAccessor(), $valueResolver);
$resolver->resolve($value, new SimpleFixture('dummy', 'Dummy', SpecificationBagFactory::create()), $set, [], new GenerationContext());
$this->fail('Expected exception to be thrown.');
} catch (NoSuchPropertyException $exception) {
$this->assertEquals('Could not find the property "prop" of the object "dummy" (class: Dummy).', $exception->getMessage());
$this->assertEquals(0, $exception->getCode());
$this->assertNotNull($exception->getPrevious());
}
}