Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\TokenParser\Chainable\PropertyReferenceTokenParserTest::testReturnsAPropertyReferenceIfCanParseToken PHP Method

testReturnsAPropertyReferenceIfCanParseToken() public method

    public function testReturnsAPropertyReferenceIfCanParseToken()
    {
        $token = new Token('@user->username', new TokenType(TokenType::PROPERTY_REFERENCE_TYPE));
        $decoratedParserProphecy = $this->prophesize(ParserInterface::class);
        $decoratedParserProphecy->parse('@user')->willReturn($reference = new FixtureReferenceValue('user'));
        /** @var ParserInterface $decoratedParser */
        $decoratedParser = $decoratedParserProphecy->reveal();
        $expected = new FixturePropertyValue($reference, 'username');
        $parser = new PropertyReferenceTokenParser($decoratedParser);
        $actual = $parser->parse($token);
        $this->assertEquals($expected, $actual);
        $decoratedParserProphecy->parse(Argument::any())->shouldHaveBeenCalledTimes(1);
    }