public denormalize ( |
||
$builtFixtures | ||
$className | string | |
$unparsedFixtureId | string | |
$specs | array | |
$flags | ||
return |
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))));
}
/** * @expectedException \Nelmio\Alice\Throwable\Exception\FixtureBuilder\Denormalizer\FlagParser\FlagParserNotFoundException * @expectedExceptionMessage Expected method "Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\Chainable\SimpleDenormalizer::denormalize" to be called only if it has a flag parser. */ public function testCannotDenormalizeFixtureIfHasNoFlagParser() { /** @var SpecificationsDenormalizerInterface $specsDenormalizer */ $specsDenormalizer = $this->prophesize(SpecificationsDenormalizerInterface::class)->reveal(); $denormalizer = new SimpleDenormalizer($specsDenormalizer); $denormalizer->denormalize(new FixtureBag(), 'Nelmio\\Alice\\Entity\\User', 'user0', [], new FlagBag('')); }