Nelmio\Alice\FixtureBag::with PHP Méthode

with() public méthode

Creates a new instance which will have the given fixture. If a fixture of that id already existed, it will be overridden.
public with ( Nelmio\Alice\FixtureInterface $fixture ) : self
$fixture Nelmio\Alice\FixtureInterface
Résultat self
    public function with(FixtureInterface $fixture) : self
    {
        $clone = clone $this;
        $clone->fixtures[$fixture->getId()] = clone $fixture;
        return $clone;
    }

Usage Example

Exemple #1
0
 /**
  * @inheritdoc
  */
 public function denormalize(FixtureBag $builtFixtures, string $className, string $unparsedFixtureId, array $specs, FlagBag $flags) : FixtureBag
 {
     if (null === $this->flagParser) {
         throw FlagParserExceptionFactory::createForExpectedMethodToBeCalledIfHasAParser(__METHOD__);
     }
     $idFlags = $this->flagParser->parse($unparsedFixtureId);
     $fixture = new SimpleFixture($idFlags->getKey(), $className, new SpecificationBag(null, new PropertyBag(), new MethodCallBag()));
     $fixture = $fixture->withSpecs($this->specsDenormalizer->denormalize($fixture, $this->flagParser, $specs));
     return $builtFixtures->with(new TemplatingFixture(new SimpleFixtureWithFlags($fixture, $idFlags->mergeWith($flags))));
 }
All Usage Examples Of Nelmio\Alice\FixtureBag::with