File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 11
11
use Http \HttplugBundle \Collector \StackPlugin ;
12
12
use Http \Promise \FulfilledPromise ;
13
13
use Http \Promise \RejectedPromise ;
14
- use PHPUnit \Framework \Error \Warning ;
15
14
use PHPUnit \Framework \TestCase ;
16
15
use Psr \Http \Message \RequestInterface ;
17
16
use Psr \Http \Message \ResponseInterface ;
@@ -188,8 +187,17 @@ public function testOnError()
188
187
$ this ->markTestSkipped ();
189
188
}
190
189
191
- //PHPUnit wrap any \Error into a \PHPUnit\Framework\Error\Warning.
192
- $ this ->expectException (Warning::class);
190
+ /*
191
+ * Use the correct PHPUnit version
192
+ * PHPUnit wrap any \Error into a \PHPUnit_Framework_Error. So we are expecting the
193
+ */
194
+ if (class_exists ('PHPUnit_Framework_Error ' )) {
195
+ // PHPUnit 5.7
196
+ $ this ->setExpectedException (\PHPUnit_Framework_Error::class);
197
+ } else {
198
+ // PHPUnit 6.0 and above
199
+ $ this ->expectException (\PHPUnit \Framework \Error \Warning::class);
200
+ }
193
201
194
202
$ this ->collector
195
203
->expects ($ this ->once ())
You can’t perform that action at this time.
0 commit comments