Nelmio\Alice\FixtureBuilder\Denormalizer\FlagParser\ElementFlagParserTest::testIfAFlagIsFoundThenParsesItWithDecoratedParserBeforeReturningTheFlags PHP Method

testIfAFlagIsFoundThenParsesItWithDecoratedParserBeforeReturningTheFlags() public method

    public function testIfAFlagIsFoundThenParsesItWithDecoratedParserBeforeReturningTheFlags()
    {
        $element = 'dummy ( flag1 , flag2 )';
        $decoratedParserProphecy = $this->prophesize(FlagParserInterface::class);
        $decoratedParserProphecy->parse('flag1')->willReturn((new FlagBag(''))->withFlag(new ElementFlag('flag1')));
        $decoratedParserProphecy->parse('flag2')->willReturn((new FlagBag(''))->withFlag(new ElementFlag('flag2'))->withFlag(new ElementFlag('additional flag')));
        /** @var FlagParserInterface $decoratedParser */
        $decoratedParser = $decoratedParserProphecy->reveal();
        $expected = (new FlagBag('dummy'))->withFlag(new ElementFlag('flag1'))->withFlag(new ElementFlag('flag2'))->withFlag(new ElementFlag('additional flag'));
        $parser = new ElementFlagParser($decoratedParser);
        $actual = $parser->parse($element);
        $this->assertEquals($expected, $actual);
    }