@@ -26,49 +26,49 @@ public function setUpMocks()
2626 public function testPassByResolverIfGivenIp ()
2727 {
2828 $ this ->resolver ->expects ($ this ->never ())->method ('resolve ' );
29- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('127.0.0.1:80 ' ))->will ($ this ->returnValue (Promise \reject ()));
29+ $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('127.0.0.1:80 ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
3030
31- $ this ->connector ->connect ('127.0.0.1:80 ' );
31+ $ this ->connector ->connect ('127.0.0.1:80 ' )-> then ( null , function () {}) ;
3232 }
3333
3434 public function testPassThroughResolverIfGivenHost ()
3535 {
3636 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('google.com ' ))->will ($ this ->returnValue (Promise \resolve ('1.2.3.4 ' )));
37- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
37+ $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
3838
39- $ this ->connector ->connect ('google.com:80 ' );
39+ $ this ->connector ->connect ('google.com:80 ' )-> then ( null , function () {}) ;
4040 }
4141
4242 public function testPassThroughResolverIfGivenHostWhichResolvesToIpv6 ()
4343 {
4444 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('google.com ' ))->will ($ this ->returnValue (Promise \resolve ('::1 ' )));
45- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('[::1]:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject ()));
45+ $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('[::1]:80?hostname=google.com ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
4646
47- $ this ->connector ->connect ('google.com:80 ' );
47+ $ this ->connector ->connect ('google.com:80 ' )-> then ( null , function () {}) ;
4848 }
4949
5050 public function testPassByResolverIfGivenCompleteUri ()
5151 {
5252 $ this ->resolver ->expects ($ this ->never ())->method ('resolve ' );
53- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('scheme://127.0.0.1:80/path?query#fragment ' ))->will ($ this ->returnValue (Promise \reject ()));
53+ $ 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 ' ) )));
5454
55- $ this ->connector ->connect ('scheme://127.0.0.1:80/path?query#fragment ' );
55+ $ this ->connector ->connect ('scheme://127.0.0.1:80/path?query#fragment ' )-> then ( null , function () {}) ;
5656 }
5757
5858 public function testPassThroughResolverIfGivenCompleteUri ()
5959 {
6060 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('google.com ' ))->will ($ this ->returnValue (Promise \resolve ('1.2.3.4 ' )));
61- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/path?query&hostname=google.com#fragment ' ))->will ($ this ->returnValue (Promise \reject ()));
61+ $ this ->tcp ->expects ($ this ->once ())->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 ' ) )));
6262
63- $ this ->connector ->connect ('scheme://google.com:80/path?query#fragment ' );
63+ $ this ->connector ->connect ('scheme://google.com:80/path?query#fragment ' )-> then ( null , function () {}) ;
6464 }
6565
6666 public function testPassThroughResolverIfGivenExplicitHost ()
6767 {
6868 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('google.com ' ))->will ($ this ->returnValue (Promise \resolve ('1.2.3.4 ' )));
69- $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/?hostname=google.de ' ))->will ($ this ->returnValue (Promise \reject ()));
69+ $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('scheme://1.2.3.4:80/?hostname=google.de ' ))->will ($ this ->returnValue (Promise \reject (new \ Exception ( ' reject ' ) )));
7070
71- $ this ->connector ->connect ('scheme://google.com:80/?hostname=google.de ' );
71+ $ this ->connector ->connect ('scheme://google.com:80/?hostname=google.de ' )-> then ( null , function () {}) ;
7272 }
7373
7474 public function testRejectsImmediatelyIfUriIsInvalid ()
@@ -134,7 +134,7 @@ public function testRejectionExceptionUsesPreviousExceptionIfDnsFails()
134134
135135 public function testCancelDuringDnsCancelsDnsAndDoesNotStartTcpConnection ()
136136 {
137- $ pending = new Promise \Promise (function () { }, $ this -> expectCallableOnce () );
137+ $ pending = new Promise \Promise (function () { }, function () { } );
138138 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('example.com ' ))->will ($ this ->returnValue ($ pending ));
139139 $ this ->tcp ->expects ($ this ->never ())->method ('connect ' );
140140
@@ -157,7 +157,7 @@ public function testCancelDuringTcpConnectionCancelsTcpConnectionIfGivenIp()
157157
158158 public function testCancelDuringTcpConnectionCancelsTcpConnectionAfterDnsIsResolved ()
159159 {
160- $ pending = new Promise \Promise (function () { }, $ this -> expectCallableOnce () );
160+ $ pending = new Promise \Promise (function () { }, function () { } );
161161 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('example.com ' ))->willReturn (Promise \resolve ('1.2.3.4 ' ));
162162 $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=example.com ' ))->willReturn ($ pending );
163163
@@ -196,7 +196,7 @@ public function testRejectionDuringDnsLookupShouldNotCreateAnyGarbageReferences(
196196 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('example.com ' ))->willReturn ($ dns ->promise ());
197197 $ this ->tcp ->expects ($ this ->never ())->method ('connect ' );
198198
199- $ promise = $ this ->connector ->connect ('example.com:80 ' );
199+ $ promise = $ this ->connector ->connect ('example.com:80 ' )-> then ( null , function () { }) ;
200200 $ dns ->reject (new \RuntimeException ('DNS failed ' ));
201201 unset($ promise , $ dns );
202202
@@ -217,7 +217,7 @@ public function testRejectionAfterDnsLookupShouldNotCreateAnyGarbageReferences()
217217 $ tcp = new Deferred ();
218218 $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=example.com ' ))->willReturn ($ tcp ->promise ());
219219
220- $ promise = $ this ->connector ->connect ('example.com:80 ' );
220+ $ promise = $ this ->connector ->connect ('example.com:80 ' )-> then ( null , function () { }) ;
221221 $ dns ->resolve ('1.2.3.4 ' );
222222 $ tcp ->reject (new \RuntimeException ('Connection failed ' ));
223223 unset($ promise , $ dns , $ tcp );
@@ -242,7 +242,7 @@ public function testRejectionAfterDnsLookupShouldNotCreateAnyGarbageReferencesAg
242242 });
243243 $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=example.com ' ))->willReturn ($ tcp ->promise ());
244244
245- $ promise = $ this ->connector ->connect ('example.com:80 ' );
245+ $ promise = $ this ->connector ->connect ('example.com:80 ' )-> then ( null , function () { }) ;
246246 $ dns ->resolve ('1.2.3.4 ' );
247247
248248 unset($ promise , $ dns , $ tcp );
@@ -264,7 +264,7 @@ public function testCancelDuringDnsLookupShouldNotCreateAnyGarbageReferences()
264264 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('example.com ' ))->willReturn ($ dns ->promise ());
265265 $ this ->tcp ->expects ($ this ->never ())->method ('connect ' );
266266
267- $ promise = $ this ->connector ->connect ('example.com:80 ' );
267+ $ promise = $ this ->connector ->connect ('example.com:80 ' )-> then ( null , function () { }) ;
268268
269269 $ promise ->cancel ();
270270 unset($ promise , $ dns );
@@ -287,7 +287,7 @@ public function testCancelDuringTcpConnectionShouldNotCreateAnyGarbageReferences
287287 });
288288 $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=example.com ' ))->willReturn ($ tcp );
289289
290- $ promise = $ this ->connector ->connect ('example.com:80 ' );
290+ $ promise = $ this ->connector ->connect ('example.com:80 ' )-> then ( function () { }, function () { }) ;
291291 $ dns ->resolve ('1.2.3.4 ' );
292292
293293 $ promise ->cancel ();
0 commit comments