PhpParser\LexerTest::testError PHP Method

testError() public method

public testError ( $code, $messages )
    public function testError($code, $messages)
    {
        if (defined('HHVM_VERSION')) {
            $this->markTestSkipped('HHVM does not throw warnings from token_get_all()');
        }
        $errorHandler = new ErrorHandler\Collecting();
        $lexer = $this->getLexer(['usedAttributes' => ['comments', 'startLine', 'endLine', 'startFilePos', 'endFilePos']]);
        $lexer->startLexing($code, $errorHandler);
        $errors = $errorHandler->getErrors();
        $this->assertSame(count($messages), count($errors));
        for ($i = 0; $i < count($messages); $i++) {
            $this->assertSame($messages[$i], $errors[$i]->getMessageWithColumnInfo($code));
        }
    }