Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\Chainable\SimpleDenormalizerTest::testDenormalizationRemovesFlagsInIds PHP Method

testDenormalizationRemovesFlagsInIds() public method

    public function testDenormalizationRemovesFlagsInIds()
    {
        $fixtures = new FixtureBag();
        $className = 'Nelmio\\Alice\\Entity\\User';
        $reference = 'user_base (template)';
        $specs = ['username' => '<name()>'];
        $flags = (new FlagBag(''))->withFlag(new ElementFlag('injected_flag'));
        $flagParserProphecy = $this->prophesize(FlagParserInterface::class);
        $flagParserProphecy->parse($reference)->willReturn((new FlagBag('user_base'))->withFlag(new TemplateFlag()));
        /** @var FlagParserInterface $flagParser */
        $flagParser = $flagParserProphecy->reveal();
        $specsDenormalizerProphecy = $this->prophesize(SpecificationsDenormalizerInterface::class);
        $expectedSpecs = new SpecificationBag(null, new PropertyBag(), new MethodCallBag());
        $specsDenormalizerProphecy->denormalize(Argument::type(SimpleFixture::class), $flagParser, $specs)->willReturn($expectedSpecs);
        /** @var SpecificationsDenormalizerInterface $specsDenormalizer */
        $specsDenormalizer = $specsDenormalizerProphecy->reveal();
        $denormalizer = (new SimpleDenormalizer($specsDenormalizer))->withFlagParser($flagParser);
        $actual = $denormalizer->denormalize($fixtures, $className, $reference, $specs, $flags);
        $expected = $fixtures->with(new TemplatingFixture(new SimpleFixtureWithFlags(new SimpleFixture('user_base', $className, $expectedSpecs), (new FlagBag('user_base'))->withFlag(new ElementFlag('injected_flag'))->withFlag(new TemplateFlag()))));
        $this->assertEquals($expected, $actual);
        $flagParserProphecy->parse(Argument::any())->shouldHaveBeenCalledTimes(1);
        $specsDenormalizerProphecy->denormalize(Argument::cetera())->shouldHaveBeenCalledTimes(1);
    }