comparison vendor/nikic/php-parser/test/PhpParser/Parser/MultipleTest.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
6 use PhpParser\Lexer; 6 use PhpParser\Lexer;
7 use PhpParser\Node\Expr; 7 use PhpParser\Node\Expr;
8 use PhpParser\Node\Scalar\LNumber; 8 use PhpParser\Node\Scalar\LNumber;
9 use PhpParser\Node\Stmt; 9 use PhpParser\Node\Stmt;
10 use PhpParser\ParserTest; 10 use PhpParser\ParserTest;
11
12 require_once __DIR__ . '/../ParserTest.php';
13 11
14 class MultipleTest extends ParserTest 12 class MultipleTest extends ParserTest
15 { 13 {
16 // This provider is for the generic parser tests, just pick an arbitrary order here 14 // This provider is for the generic parser tests, just pick an arbitrary order here
17 protected function getParser(Lexer $lexer) { 15 protected function getParser(Lexer $lexer) {
82 $this->expectException(Error::class); 80 $this->expectException(Error::class);
83 $this->expectExceptionMessage('FAIL A'); 81 $this->expectExceptionMessage('FAIL A');
84 82
85 $parserA = $this->getMockBuilder(\PhpParser\Parser::class)->getMock(); 83 $parserA = $this->getMockBuilder(\PhpParser\Parser::class)->getMock();
86 $parserA->expects($this->at(0)) 84 $parserA->expects($this->at(0))
87 ->method('parse')->will($this->throwException(new Error('FAIL A'))); 85 ->method('parse')->willThrowException(new Error('FAIL A'));
88 86
89 $parserB = $this->getMockBuilder(\PhpParser\Parser::class)->getMock(); 87 $parserB = $this->getMockBuilder(\PhpParser\Parser::class)->getMock();
90 $parserB->expects($this->at(0)) 88 $parserB->expects($this->at(0))
91 ->method('parse')->will($this->throwException(new Error('FAIL B'))); 89 ->method('parse')->willThrowException(new Error('FAIL B'));
92 90
93 $parser = new Multiple([$parserA, $parserB]); 91 $parser = new Multiple([$parserA, $parserB]);
94 $parser->parse('dummy'); 92 $parser->parse('dummy');
95 } 93 }
96 } 94 }