Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\TokenParser\Chainable\SimpleReferenceTokenParserTest::testThrowsAnErrorIfAMalformedTokenIsGiven PHP Method

testThrowsAnErrorIfAMalformedTokenIsGiven() public method

    public function testThrowsAnErrorIfAMalformedTokenIsGiven()
    {
        try {
            $token = new Token('', new TokenType(TokenType::SIMPLE_REFERENCE_TYPE));
            $parser = new SimpleReferenceTokenParser();
            $parser->parse($token);
            $this->fail('Expected exception to be thrown.');
        } catch (ParseException $exception) {
            $this->assertEquals('Could not parse the token "" (type: SIMPLE_REFERENCE_TYPE).', $exception->getMessage());
            $this->assertEquals(0, $exception->getCode());
            $this->assertNotNull($exception->getPrevious());
        }
    }