public function testReturnsResultOfTheDecoratedResolverIfReferenceDoesNotMatchSelf() { $valueProphecy = $this->prophesize(ValueInterface::class); $valueProphecy->getValue()->willReturn('a_random_fixture_id'); /** @var ValueInterface $value */ $value = $valueProphecy->reveal(); $expectedObject = new \stdClass(); $expectedObject->foo = 'bar'; $set = ResolvedFixtureSetFactory::create(null, $fixtureBag = (new FixtureBag())->with($dummyFixture = new SimpleFixture('dummy', 'Dummy', SpecificationBagFactory::create()))->with($anotherDummyFixture = new SimpleFixture('another_dummy', 'Dummy', SpecificationBagFactory::create())), new ObjectBag(['dummy' => $expectedObject])); $scope = ['injected' => true]; $context = new GenerationContext(); $context->markIsResolvingFixture('bar'); $decoratedResolverProphecy = $this->prophesize(ChainableValueResolverInterface::class); $decoratedResolverProphecy->resolve($value, $dummyFixture, $set, $scope, $context)->willReturn($expected = new ResolvedValueWithFixtureSet($resolvedFixture = new SimpleFixture('resolved_fixture', 'Dummy', SpecificationBagFactory::create()), ResolvedFixtureSetFactory::create(null, $fixtureBag->with($resolvedFixture)))); /** @var ChainableValueResolverInterface $decoratedResolver */ $decoratedResolver = $decoratedResolverProphecy->reveal(); $resolver = new SelfFixtureReferenceResolver($decoratedResolver); $actual = $resolver->resolve($value, $dummyFixture, $set, $scope, $context); $this->assertEquals($expected, $actual); $valueProphecy->getValue()->shouldHaveBeenCalledTimes(1); $decoratedResolverProphecy->resolve(Argument::cetera())->shouldHaveBeenCalledTimes(1); }