mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-11-26 20:04:48 +01:00
Test lexer returning invalid token
This commit is contained in:
parent
a710f32a6a
commit
0a445c7656
@ -114,4 +114,21 @@ EOC;
|
||||
'endTokenPos' => 18,
|
||||
), $var->getAttributes());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RangeException
|
||||
* @expectedExceptionMessage The lexer returned an invalid token (id=999, value=foobar)
|
||||
*/
|
||||
public function testInvalidToken() {
|
||||
$lexer = new InvalidTokenLexer;
|
||||
$parser = new Parser($lexer);
|
||||
$parser->parse('dummy');
|
||||
}
|
||||
}
|
||||
|
||||
class InvalidTokenLexer extends Lexer {
|
||||
public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) {
|
||||
$value = 'foobar';
|
||||
return 999;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user