markTestSkipped('HHVM does not throw warnings from token_get_all()'); } $errorHandler = new ErrorHandler\Collecting(); $lexer = $this->getLexer(); $lexer->tokenize($code, $errorHandler); $errors = $errorHandler->getErrors(); $this->assertCount(count($messages), $errors); for ($i = 0; $i < count($messages); $i++) { $this->assertSame($messages[$i], $errors[$i]->getMessageWithColumnInfo($code)); } } public static function provideTestError() { return [ ["expectException(Error::class); $this->expectExceptionMessage('Unterminated comment on line 1'); $lexer = $this->getLexer(); $lexer->tokenize("getLexer(); $tokens = $lexer->tokenize($code); foreach ($tokens as $token) { if ($token->id === 0 || $token->isIgnorable()) { continue; } $expectedToken = array_shift($expectedTokens); $this->assertSame($expectedToken[0], $token->id); $this->assertSame($expectedToken[1], $token->text); } } public static function provideTestLex() { return [ // tests PHP 8 T_NAME_* emulation [ 'getLexer(); $this->assertEquals($expectedTokens, $lexer->tokenize($code)); } }