lexer = new PHPParser_Lexer; } /** * @dataProvider provideTestError */ public function testError($code, $message) { try { $this->lexer->startLexing($code); } catch (PHPParser_Error $e) { $this->assertEquals($message, $e->getMessage()); return; } $this->fail('Expected PHPParser_Error'); } public function provideTestError() { return array( array('lexer->startLexing($code); while ($id = $this->lexer->getNextToken($value, $line, $docComment)) { $token = array_shift($tokens); $this->assertEquals($token[0], $id); $this->assertEquals($token[1], $value); $this->assertEquals($token[2], $line); $this->assertEquals($token[3], $docComment); } } public function provideTestLex() { return array( // tests conversion of closing PHP tag and drop of whitespace, comments and opening tags array( 'plaintext', array( array(PHPParser_Parser::T_STRING, 'tokens', 1, null), array(ord(';'), '?>', 1, null), array(PHPParser_Parser::T_INLINE_HTML, 'plaintext', 1, null), ) ), // tests line numbers array( 'lexer->startLexing($code); while (PHPParser_Parser::T_HALT_COMPILER !== $this->lexer->getNextToken()); $this->assertEquals($this->lexer->handleHaltCompiler(), $remaining); $this->assertEquals(0, $this->lexer->getNextToken()); } public function provideTestHaltCompiler() { return array( array('Remaining Text', 'Remaining Text'), //array('