@@ -173,23 +173,26 @@ public function testEvaluateMatchesWithInvalidRegexp()
173
173
{
174
174
$ node = new BinaryNode ('matches ' , new ConstantNode ('abc ' ), new ConstantNode ('this is not a regexp ' ));
175
175
176
- $ this ->expectExceptionObject (new SyntaxError ('Regexp "this is not a regexp" passed to "matches" is not valid: Delimiter must not be alphanumeric ' ));
176
+ $ this ->expectException (SyntaxError::class);
177
+ $ this ->expectExceptionMessage ('Regexp "this is not a regexp" passed to "matches" is not valid: Delimiter must not be alphanumeric ' );
177
178
$ node ->evaluate ([], []);
178
179
}
179
180
180
181
public function testEvaluateMatchesWithInvalidRegexpAsExpression ()
181
182
{
182
183
$ node = new BinaryNode ('matches ' , new ConstantNode ('abc ' ), new NameNode ('regexp ' ));
183
184
184
- $ this ->expectExceptionObject (new SyntaxError ('Regexp "this is not a regexp" passed to "matches" is not valid: Delimiter must not be alphanumeric ' ));
185
+ $ this ->expectException (SyntaxError::class);
186
+ $ this ->expectExceptionMessage ('Regexp "this is not a regexp" passed to "matches" is not valid: Delimiter must not be alphanumeric ' );
185
187
$ node ->evaluate ([], ['regexp ' => 'this is not a regexp ' ]);
186
188
}
187
189
188
190
public function testCompileMatchesWithInvalidRegexp ()
189
191
{
190
192
$ node = new BinaryNode ('matches ' , new ConstantNode ('abc ' ), new ConstantNode ('this is not a regexp ' ));
191
193
192
- $ this ->expectExceptionObject (new SyntaxError ('Regexp "this is not a regexp" passed to "matches" is not valid: Delimiter must not be alphanumeric ' ));
194
+ $ this ->expectException (SyntaxError::class);
195
+ $ this ->expectExceptionMessage ('Regexp "this is not a regexp" passed to "matches" is not valid: Delimiter must not be alphanumeric ' );
193
196
$ compiler = new Compiler ([]);
194
197
$ node ->compile ($ compiler );
195
198
}
@@ -198,7 +201,8 @@ public function testCompileMatchesWithInvalidRegexpAsExpression()
198
201
{
199
202
$ node = new BinaryNode ('matches ' , new ConstantNode ('abc ' ), new NameNode ('regexp ' ));
200
203
201
- $ this ->expectExceptionObject (new SyntaxError ('Regexp "this is not a regexp" passed to "matches" is not valid: Delimiter must not be alphanumeric ' ));
204
+ $ this ->expectException (SyntaxError::class);
205
+ $ this ->expectExceptionMessage ('Regexp "this is not a regexp" passed to "matches" is not valid: Delimiter must not be alphanumeric ' );
202
206
$ compiler = new Compiler ([]);
203
207
$ node ->compile ($ compiler );
204
208
eval ('$regexp = "this is not a regexp"; ' .$ compiler ->getSource ().'; ' );
0 commit comments