public function add(UniqueValue $value) { $valueId = $value->getId(); if (false === array_key_exists($valueId, $this->pool)) { $this->pool[$valueId] = []; } $this->pool[$valueId][] = $value->getValue(); }
public function testImmutableFactories() { $id = 'Nelmio\\Entity\\User#user0#username'; $value = new \stdClass(); $newValue = new \stdClass(); $newValue->foo = 'bar'; $original = new UniqueValue($id, $value); $clone = $original->withValue($newValue); $this->assertInstanceOf(UniqueValue::class, $clone); $this->assertEquals($id, $original->getId()); $this->assertEquals($id, $clone->getId()); $this->assertEquals($value, $original->getValue()); $this->assertEquals($newValue, $clone->getValue()); }
private function generateValue(UniqueValue $value, FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, array $scope, GenerationContext $context) : array { $realValue = $value->getValue(); if ($realValue instanceof ValueInterface) { $result = $this->resolver->resolve($value->getValue(), $fixture, $fixtureSet, $scope, $context); return [$value->withValue($result->getValue()), $result->getSet()]; } return [$value, $fixtureSet]; }