@@ -81,7 +81,7 @@ public function testPassByResolverIfGivenIp()
81
81
public function testPassByResolverIfGivenIpv6 ()
82
82
{
83
83
$ this ->resolver ->expects ($ this ->never ())->method ('resolveAll ' );
84
- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('[::1]:80 ' ))->will ($ this ->returnValue (Promise \reject ()));
84
+ $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('[::1]:80 ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
85
85
86
86
$ this ->connector ->connect ('[::1]:80 ' );
87
87
@@ -91,7 +91,7 @@ public function testPassByResolverIfGivenIpv6()
91
91
public function testPassThroughResolverIfGivenHost ()
92
92
{
93
93
$ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('1.2.3.4 ' ))));
94
- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
94
+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
95
95
96
96
$ this ->connector ->connect ('google.com:80 ' );
97
97
@@ -101,7 +101,7 @@ public function testPassThroughResolverIfGivenHost()
101
101
public function testPassThroughResolverIfGivenHostWhichResolvesToIpv6 ()
102
102
{
103
103
$ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('::1 ' ))));
104
- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('[::1]:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
104
+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('[::1]:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
105
105
106
106
$ this ->connector ->connect ('google.com:80 ' );
107
107
@@ -111,7 +111,7 @@ public function testPassThroughResolverIfGivenHostWhichResolvesToIpv6()
111
111
public function testPassByResolverIfGivenCompleteUri ()
112
112
{
113
113
$ this ->resolver ->expects ($ this ->never ())->method ('resolveAll ' );
114
- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('scheme://127.0.0.1:80/path?query#fragment ' ))->will ($ this ->returnValue (Promise \reject ()));
114
+ $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('scheme://127.0.0.1:80/path?query#fragment ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
115
115
116
116
$ this ->connector ->connect ('scheme://127.0.0.1:80/path?query#fragment ' );
117
117
@@ -121,7 +121,7 @@ public function testPassByResolverIfGivenCompleteUri()
121
121
public function testPassThroughResolverIfGivenCompleteUri ()
122
122
{
123
123
$ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('1.2.3.4 ' ))));
124
- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/path?query&hostname=google.com#fragment ' ))->will ($ this ->returnValue (Promise \reject ()));
124
+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/path?query&hostname=google.com#fragment ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
125
125
126
126
$ this ->connector ->connect ('scheme://google.com:80/path?query#fragment ' );
127
127
@@ -131,7 +131,7 @@ public function testPassThroughResolverIfGivenCompleteUri()
131
131
public function testPassThroughResolverIfGivenExplicitHost ()
132
132
{
133
133
$ this ->resolver ->expects ($ this ->exactly (2 ))->method ('resolveAll ' )->with ($ this ->equalTo ('google.com ' ), $ this ->anything ())->will ($ this ->returnValue (Promise \resolve (array ('1.2.3.4 ' ))));
134
- $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/?hostname=google.de ' ))->will ($ this ->returnValue (Promise \reject ()));
134
+ $ this ->tcp ->expects ($ this ->exactly (2 ))->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/?hostname=google.de ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
135
135
136
136
$ this ->connector ->connect ('scheme://google.com:80/?hostname=google.de ' );
137
137
@@ -171,12 +171,12 @@ public function testIpv6ResolvesFirstSoIsTheFirstToConnect(array $ipv6, array $i
171
171
172
172
$ this ->resolver ->expects ($ this ->at (0 ))->method ('resolveAll ' )->with ('google.com ' , Message::TYPE_AAAA )->will ($ this ->returnValue (Promise \resolve ($ ipv6 )));
173
173
$ this ->resolver ->expects ($ this ->at (1 ))->method ('resolveAll ' )->with ('google.com ' , Message::TYPE_A )->will ($ this ->returnValue ($ deferred ->promise ()));
174
- $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (']:80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
174
+ $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (']:80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
175
175
176
176
$ this ->connector ->connect ('scheme://google.com:80/?hostname=google.com ' );
177
177
178
178
$ this ->loop ->addTimer (0.07 , function () use ($ deferred ) {
179
- $ deferred ->reject ();
179
+ $ deferred ->reject (new \ Exception ( ' reject ' ) );
180
180
});
181
181
182
182
$ this ->loop ->run ();
@@ -191,12 +191,12 @@ public function testIpv6DoesntResolvesWhileIpv4DoesFirstSoIpv4Connects(array $ip
191
191
192
192
$ this ->resolver ->expects ($ this ->at (0 ))->method ('resolveAll ' )->with ('google.com ' , Message::TYPE_AAAA )->will ($ this ->returnValue ($ deferred ->promise ()));
193
193
$ this ->resolver ->expects ($ this ->at (1 ))->method ('resolveAll ' )->with ('google.com ' , Message::TYPE_A )->will ($ this ->returnValue (Promise \resolve ($ ipv4 )));
194
- $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (':80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
194
+ $ this ->tcp ->expects ($ this ->any ())->method ('connect ' )->with ($ this ->stringContains (':80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
195
195
196
196
$ this ->connector ->connect ('scheme://google.com:80/?hostname=google.com ' );
197
197
198
198
$ this ->loop ->addTimer (0.07 , function () use ($ deferred ) {
199
- $ deferred ->reject ();
199
+ $ deferred ->reject (new \ Exception ( ' reject ' ) );
200
200
});
201
201
202
202
$ this ->loop ->run ();
@@ -290,10 +290,10 @@ public function testAttemptsToConnectBothIpv6AndIpv4AddressesAlternatingIpv6AndI
290
290
$ i = 0 ;
291
291
while (count ($ ipv6 ) > 0 || count ($ ipv4 ) > 0 ) {
292
292
if (count ($ ipv6 ) > 0 ) {
293
- $ this ->tcp ->expects ($ this ->at ($ i ++))->method ('connect ' )->with ($ this ->equalTo ('scheme://[ ' . array_shift ($ ipv6 ) . ']:80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
293
+ $ this ->tcp ->expects ($ this ->at ($ i ++))->method ('connect ' )->with ($ this ->equalTo ('scheme://[ ' . array_shift ($ ipv6 ) . ']:80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
294
294
}
295
295
if (count ($ ipv4 ) > 0 ) {
296
- $ this ->tcp ->expects ($ this ->at ($ i ++))->method ('connect ' )->with ($ this ->equalTo ('scheme:// ' . array_shift ($ ipv4 ) . ':80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
296
+ $ this ->tcp ->expects ($ this ->at ($ i ++))->method ('connect ' )->with ($ this ->equalTo ('scheme:// ' . array_shift ($ ipv4 ) . ':80/?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
297
297
}
298
298
}
299
299
0 commit comments