comparison vendor/nikic/php-parser/test/PhpParser/LexerTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 5fb285c0d0e3
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
1 <?php declare(strict_types=1); 1 <?php declare(strict_types=1);
2 2
3 namespace PhpParser; 3 namespace PhpParser;
4 4
5 use PhpParser\Parser\Tokens; 5 use PhpParser\Parser\Tokens;
6 use PHPUnit\Framework\TestCase; 6
7 7 class LexerTest extends \PHPUnit\Framework\TestCase
8 class LexerTest extends TestCase
9 { 8 {
10 /* To allow overwriting in parent class */ 9 /* To allow overwriting in parent class */
11 protected function getLexer(array $options = []) { 10 protected function getLexer(array $options = []) {
12 return new Lexer($options); 11 return new Lexer($options);
13 } 12 }
233 //array('<?php ... __halt_compiler();' . "\0", "\0"), 232 //array('<?php ... __halt_compiler();' . "\0", "\0"),
234 //array('<?php ... __halt_compiler /* */ ( ) ;Remaining Text', 'Remaining Text'), 233 //array('<?php ... __halt_compiler /* */ ( ) ;Remaining Text', 'Remaining Text'),
235 ]; 234 ];
236 } 235 }
237 236
238 /**
239 * @expectedException \PhpParser\Error
240 * @expectedExceptionMessage __HALT_COMPILER must be followed by "();"
241 */
242 public function testHandleHaltCompilerError() { 237 public function testHandleHaltCompilerError() {
238 $this->expectException(Error::class);
239 $this->expectExceptionMessage('__HALT_COMPILER must be followed by "();"');
243 $lexer = $this->getLexer(); 240 $lexer = $this->getLexer();
244 $lexer->startLexing('<?php ... __halt_compiler invalid ();'); 241 $lexer->startLexing('<?php ... __halt_compiler invalid ();');
245 242
246 while (Tokens::T_HALT_COMPILER !== $lexer->getNextToken()); 243 while (Tokens::T_HALT_COMPILER !== $lexer->getNextToken());
247 $lexer->handleHaltCompiler(); 244 $lexer->handleHaltCompiler();