resolve() public method

public resolve ( Nelmio\Alice\Definition\ValueInterface $list, Nelmio\Alice\FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, array $scope, GenerationContext $context ) : ResolvedValueWithFixtureSet
$list Nelmio\Alice\Definition\ValueInterface
$fixture Nelmio\Alice\FixtureInterface
$fixtureSet Nelmio\Alice\Generator\ResolvedFixtureSet
$scope array
$context Nelmio\Alice\Generator\GenerationContext
return Nelmio\Alice\Generator\ResolvedValueWithFixtureSet
Beispiel #1
0
 public function testResolvesAllTheValuesInArrayBeforeImplodingIt()
 {
     $value = new ListValue(['a', new FakeValue(), 'c', new FakeValue()]);
     $fixture = new FakeFixture();
     $set = ResolvedFixtureSetFactory::create(new ParameterBag(['foo' => 'bar']));
     $scope = ['scope' => 'epocs'];
     $context = new GenerationContext();
     $context->markIsResolvingFixture('foo');
     $valueResolverProphecy = $this->prophesize(ValueResolverInterface::class);
     $valueResolverProphecy->resolve(new FakeValue(), $fixture, $set, $scope, $context)->willReturn(new ResolvedValueWithFixtureSet('b', $newSet = ResolvedFixtureSetFactory::create(new ParameterBag(['foo' => 'baz']))));
     $valueResolverProphecy->resolve(new FakeValue(), $fixture, $newSet, $scope, $context)->willReturn(new ResolvedValueWithFixtureSet('d', $newSet2 = ResolvedFixtureSetFactory::create(new ParameterBag(['foo' => 'zab']))));
     /** @var ValueResolverInterface $valueResolver */
     $valueResolver = $valueResolverProphecy->reveal();
     $expected = new ResolvedValueWithFixtureSet('abcd', $newSet2);
     $resolver = new ListValueResolver($valueResolver);
     $actual = $resolver->resolve($value, $fixture, $set, $scope, $context);
     $this->assertEquals($expected, $actual);
     $valueResolverProphecy->resolve(Argument::cetera())->shouldHaveBeenCalledTimes(2);
 }