/** * {@inheritdoc} * * @param UniqueValue $value * * @throws UniqueValueGenerationLimitReachedException */ public function resolve(ValueInterface $value, FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, array $scope, GenerationContext $context, int $tryCounter = 0) : ResolvedValueWithFixtureSet { $this->checkResolver(__METHOD__); $tryCounter = $this->incrementCounter($tryCounter, $value, $this->limit); /** * @var UniqueValue $generatedValue * @var ResolvedFixtureSet $fixtureSet */ list($generatedValue, $fixtureSet) = $this->generateValue($value, $fixture, $fixtureSet, $scope, $context); if ($this->pool->has($generatedValue)) { return $this->resolve($value, $fixture, $fixtureSet, $scope, $context, $tryCounter); } $this->pool->add($generatedValue); return new ResolvedValueWithFixtureSet($generatedValue->getValue(), $fixtureSet); }
/** * @dataProvider provideHasValueSet */ public function testHasObjectValue(UniqueValuesPool $pool, UniqueValue $value, bool $expected) { $this->assertEquals($expected, $pool->has($value)); $pool->add($value); $this->assertTrue($pool->has($value)); }