This repository was archived by the owner on Jan 31, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 7
7
8
8
namespace ZendDiagnostics \Check ;
9
9
10
+ use InvalidArgumentException ;
10
11
use Guzzle \Http \Client as Guzzle3Client ;
11
12
use Guzzle \Http \ClientInterface as Guzzle3ClientInterface ;
12
13
use GuzzleHttp \Client as Guzzle456Client ;
@@ -58,7 +59,7 @@ public function __construct(
58
59
}
59
60
60
61
if ((! $ guzzle instanceof Guzzle3ClientInterface) && (! $ guzzle instanceof Guzzle456ClientInterface)) {
61
- throw new \ InvalidArgumentException (
62
+ throw new InvalidArgumentException (
62
63
'Parameter "guzzle" must be an instance of "\Guzzle\Http\ClientInterface" '
63
64
. ' or "\GuzzleHttp\ClientInterface" '
64
65
);
@@ -84,15 +85,17 @@ public function check()
84
85
*/
85
86
private function guzzle3Check ()
86
87
{
87
- $ response = $ this ->guzzle ->createRequest (
88
- $ this ->method ,
89
- $ this ->url ,
90
- $ this ->headers ,
91
- $ this ->body ,
92
- array_merge (['exceptions ' => false ], $ this ->options )
93
- )->send ();
94
-
95
- if ($ this ->statusCode !== $ statusCode = $ response ->getStatusCode ()) {
88
+ $ response = $ this ->guzzle
89
+ ->createRequest (
90
+ $ this ->method ,
91
+ $ this ->url ,
92
+ $ this ->headers ,
93
+ $ this ->body ,
94
+ array_merge (['exceptions ' => false ], $ this ->options )
95
+ )
96
+ ->send ();
97
+
98
+ if ($ this ->statusCode !== ($ statusCode = $ response ->getStatusCode ())) {
96
99
return $ this ->createStatusCodeFailure ($ statusCode );
97
100
}
98
101
Original file line number Diff line number Diff line change @@ -66,7 +66,10 @@ public function testRabbitMQ()
66
66
$ this ->assertInstanceOf (Success::class, $ result );
67
67
68
68
$ check = new RabbitMQ ('127.0.0.250 ' , 9999 );
69
- $ this ->expectException (ErrorException::class);
69
+ // Exception type varies between different versions of php-amqplib;
70
+ // sometimes it is a descendent of ErrorException, sometimes
71
+ // RuntimeException. As such, catching any exception here.
72
+ $ this ->expectException (Exception::class);
70
73
$ check ->check ();
71
74
}
72
75
You can’t perform that action at this time.
0 commit comments