@@ -41,14 +41,16 @@ public function testSuccessiveCallMustUseResponseInterface()
41
41
);
42
42
43
43
$ promise = $ this ->httpAsyncClient ->sendAsyncRequest ($ request );
44
- $ this ->assertInstanceOf ('Http\Client \Promise ' , $ promise );
44
+ $ this ->assertInstanceOf ('Http\Promise \Promise ' , $ promise );
45
45
46
46
$ response = null ;
47
47
$ promise ->then ()->then ()->then (function ($ r ) use (&$ response ) {
48
48
$ response = $ r ;
49
+
50
+ return $ response ;
49
51
});
50
52
51
- $ promise ->wait ();
53
+ $ promise ->wait (false );
52
54
$ this ->assertResponse (
53
55
$ response ,
54
56
[
@@ -66,17 +68,21 @@ public function testSuccessiveInvalidCallMustUseException()
66
68
);
67
69
68
70
$ promise = $ this ->httpAsyncClient ->sendAsyncRequest ($ request );
69
- $ this ->assertInstanceOf ('Http\Client \Promise ' , $ promise );
71
+ $ this ->assertInstanceOf ('Http\Promise \Promise ' , $ promise );
70
72
71
73
$ exception = null ;
72
74
$ response = null ;
73
75
$ promise ->then ()->then ()->then (function ($ r ) use (&$ response ) {
74
76
$ response = $ r ;
77
+
78
+ return $ response ;
75
79
}, function ($ e ) use (&$ exception ) {
76
80
$ exception = $ e ;
81
+
82
+ throw $ e ;
77
83
});
78
84
79
- $ promise ->wait ();
85
+ $ promise ->wait (false );
80
86
81
87
$ this ->assertNull ($ response );
82
88
$ this ->assertNotNull ($ exception );
@@ -101,11 +107,13 @@ public function testAsyncSendRequest($method, $uri, array $headers, $body)
101
107
);
102
108
103
109
$ promise = $ this ->httpAsyncClient ->sendAsyncRequest ($ request );
104
- $ this ->assertInstanceOf ('Http\Client \Promise ' , $ promise );
110
+ $ this ->assertInstanceOf ('Http\Promise \Promise ' , $ promise );
105
111
106
112
$ response = null ;
107
113
$ promise ->then (function ($ r ) use (&$ response ) {
108
114
$ response = $ r ;
115
+
116
+ return $ response ;
109
117
});
110
118
111
119
$ promise ->wait ();
@@ -132,14 +140,18 @@ public function testSendAsyncWithInvalidUri()
132
140
$ exception = null ;
133
141
$ response = null ;
134
142
$ promise = $ this ->httpAsyncClient ->sendAsyncRequest ($ request );
135
- $ this ->assertInstanceOf ('Http\Client \Promise ' , $ promise );
143
+ $ this ->assertInstanceOf ('Http\Promise \Promise ' , $ promise );
136
144
137
145
$ promise ->then (function ($ r ) use (&$ response ) {
138
146
$ response = $ r ;
147
+
148
+ return $ response ;
139
149
}, function ($ e ) use (&$ exception ) {
140
150
$ exception = $ e ;
151
+
152
+ throw $ e ;
141
153
});
142
- $ promise ->wait ();
154
+ $ promise ->wait (false );
143
155
144
156
$ this ->assertNull ($ response );
145
157
$ this ->assertNotNull ($ exception );
@@ -175,9 +187,11 @@ public function testSendAsyncRequestWithOutcome($uriAndOutcome, $protocolVersion
175
187
$ promise = $ this ->httpAsyncClient ->sendAsyncRequest ($ request );
176
188
$ promise ->then (function ($ r ) use (&$ response ) {
177
189
$ response = $ r ;
190
+
191
+ return $ response ;
178
192
});
179
193
180
- $ this ->assertInstanceOf ('Http\Client \Promise ' , $ promise );
194
+ $ this ->assertInstanceOf ('Http\Promise \Promise ' , $ promise );
181
195
$ promise ->wait ();
182
196
$ this ->assertResponse (
183
197
$ response ,
@@ -186,4 +200,3 @@ public function testSendAsyncRequestWithOutcome($uriAndOutcome, $protocolVersion
186
200
$ this ->assertRequest ($ method , $ headers , $ body , $ protocolVersion );
187
201
}
188
202
}
189
-
0 commit comments