resolve() public method

public resolve ( Nelmio\Alice\Definition\ValueInterface $value, Nelmio\Alice\FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, array $scope, GenerationContext $context, integer $tryCounter ) : ResolvedValueWithFixtureSet
$value Nelmio\Alice\Definition\ValueInterface
$fixture Nelmio\Alice\FixtureInterface
$fixtureSet Nelmio\Alice\Generator\ResolvedFixtureSet
$scope array
$context Nelmio\Alice\Generator\GenerationContext
$tryCounter integer
return Nelmio\Alice\Generator\ResolvedValueWithFixtureSet
Example #1
0
 public function testThrowsIfLimitForGenerationOfUniqueValuesIsReached()
 {
     $uniqueId = 'uniqid';
     $realValue = new FakeValue();
     $value = new UniqueValue($uniqueId, $realValue);
     $fixture = new FakeFixture();
     $set = ResolvedFixtureSetFactory::create();
     $scope = ['scope' => 'epocs'];
     $context = new GenerationContext();
     $context->markIsResolvingFixture('foo');
     $pool = new UniqueValuesPool();
     $pool->add(new UniqueValue($uniqueId, 10));
     $pool->add(new UniqueValue($uniqueId, 11));
     $decoratedResolverProphecy = $this->prophesize(ValueResolverInterface::class);
     $decoratedResolverProphecy->resolve($realValue, $fixture, $set, $scope, $context)->willReturn(new ResolvedValueWithFixtureSet(10, $set));
     /** @var ValueResolverInterface $decoratedResolver */
     $decoratedResolver = $decoratedResolverProphecy->reveal();
     $resolver = new UniqueValueResolver($pool, $decoratedResolver);
     try {
         $resolver->resolve($value, $fixture, $set, $scope, $context);
         $this->fail('Expected exception to be thrown.');
     } catch (UniqueValueGenerationLimitReachedException $exception) {
         $decoratedResolverProphecy->resolve(Argument::cetera())->shouldHaveBeenCalledTimes(150);
     }
 }