public function denormalize(FixtureBag $builtFixtures, string $className, string $fixtureId, array $specs, FlagBag $flags) : FixtureBag
{
foreach ($this->denormalizers as $denormalizer) {
if ($denormalizer->canDenormalize($fixtureId)) {
return $denormalizer->denormalize($builtFixtures, $className, $fixtureId, $specs, $flags);
}
}
throw DenormalizerExceptionFactory::createDenormalizerNotFoundForFixture($fixtureId);
}
/** * @expectedException \Nelmio\Alice\Throwable\Exception\FixtureBuilder\Denormalizer\DenormalizerNotFoundException * @expectedExceptionMessage No suitable fixture denormalizer found to handle the fixture with the reference "user0". */ public function testThrowsExceptionIfNotSuitableDenormalizer() { $builtFixtures = new FixtureBag(); $className = 'Nelmio\\Alice\\Entity\\User'; $reference = 'user0'; $specs = ['username' => '<name()>']; $flags = new FlagBag(''); $flagParserProphecy = $this->prophesize(FlagParserInterface::class); $flagParserProphecy->parse(Argument::any())->shouldNotBeCalled(); /** @var FlagParserInterface $flagParser */ $flagParser = $flagParserProphecy->reveal(); $denormalizer = new FixtureDenormalizerRegistry($flagParser, []); $denormalizer->denormalize($builtFixtures, $className, $reference, $specs, $flags); }