Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\TokenParser\Chainable\StringArrayTokenParserTest::testParsesEachArrayElementAndReturnsTheConstructedArray PHP Метод

testParsesEachArrayElementAndReturnsTheConstructedArray() публичный Метод

    public function testParsesEachArrayElementAndReturnsTheConstructedArray()
    {
        $token = new Token('[val1, val2]', new TokenType(TokenType::STRING_ARRAY_TYPE));
        $decoratedParserProphecy = $this->prophesize(ParserInterface::class);
        $decoratedParserProphecy->parse('val1')->willReturn('parsed_val1');
        $decoratedParserProphecy->parse('val2')->willReturn('parsed_val2');
        /** @var ParserInterface $decoratedParser */
        $decoratedParser = $decoratedParserProphecy->reveal();
        $expected = ['parsed_val1', 'parsed_val2'];
        $parser = new StringArrayTokenParser($decoratedParser);
        $actual = $parser->parse($token);
        $this->assertEquals($expected, $actual);
        $decoratedParserProphecy->parse(Argument::any())->shouldHaveBeenCalledTimes(2);
    }