File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 3
3
namespace PhpParser \Parser ;
4
4
5
5
use PhpParser \Error ;
6
+ use PhpParser \ErrorHandler ;
6
7
use PhpParser \Lexer ;
7
8
use PhpParser \Node \Expr ;
8
9
use PhpParser \Node \Scalar \LNumber ;
9
10
use PhpParser \Node \Stmt ;
11
+ use PhpParser \ParserAbstract ;
10
12
use PhpParser \ParserTest ;
11
13
12
14
class MultipleTest extends ParserTest
@@ -80,11 +82,16 @@ public function testThrownError() {
80
82
$ this ->expectException (Error::class);
81
83
$ this ->expectExceptionMessage ('FAIL A ' );
82
84
83
- $ parserA = $ this ->getMockBuilder (\PhpParser \Parser::class)->getMock ();
84
- $ parserA ->method ('parse ' )->willThrowException (new Error ('FAIL A ' ));
85
-
86
- $ parserB = $ this ->getMockBuilder (\PhpParser \Parser::class)->getMock ();
87
- $ parserB ->method ('parse ' )->willThrowException (new Error ('FAIL B ' ));
85
+ $ parserA = new class implements \PhpParser \Parser {
86
+ public function parse (string $ code , ErrorHandler $ errorHandler = null ) {
87
+ throw new Error ('FAIL A ' );
88
+ }
89
+ };
90
+ $ parserB = new class implements \PhpParser \Parser {
91
+ public function parse (string $ code , ErrorHandler $ errorHandler = null ) {
92
+ throw new Error ('FAIL B ' );
93
+ }
94
+ };
88
95
89
96
$ parser = new Multiple ([$ parserA , $ parserB ]);
90
97
$ parser ->parse ('dummy ' );
You can’t perform that action at this time.
0 commit comments