@@ -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 ()
@@ -205,7 +205,7 @@ public function testRejectionExceptionUsesPreviousExceptionIfDnsFails()
205205
206206 public function testCancelDuringDnsCancelsDnsAndDoesNotStartTcpConnection ()
207207 {
208- $ pending = new Promise \Promise (function () { }, $ this -> expectCallableOnce () );
208+ $ pending = new Promise \Promise (function () { }, function () { } );
209209 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('example.com ' ))->will ($ this ->returnValue ($ pending ));
210210 $ this ->tcp ->expects ($ this ->never ())->method ('connect ' );
211211
@@ -237,7 +237,7 @@ public function testCancelDuringTcpConnectionCancelsTcpConnectionIfGivenIp()
237237
238238 public function testCancelDuringTcpConnectionCancelsTcpConnectionAfterDnsIsResolved ()
239239 {
240- $ pending = new Promise \Promise (function () { }, $ this -> expectCallableOnce () );
240+ $ pending = new Promise \Promise (function () { }, function () { } );
241241 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('example.com ' ))->willReturn (Promise \resolve ('1.2.3.4 ' ));
242242 $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=example.com ' ))->willReturn ($ pending );
243243
@@ -288,7 +288,7 @@ public function testRejectionDuringDnsLookupShouldNotCreateAnyGarbageReferences(
288288 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('example.com ' ))->willReturn ($ dns ->promise ());
289289 $ this ->tcp ->expects ($ this ->never ())->method ('connect ' );
290290
291- $ promise = $ this ->connector ->connect ('example.com:80 ' );
291+ $ promise = $ this ->connector ->connect ('example.com:80 ' )-> then ( null , function () { }) ;
292292 $ dns ->reject (new \RuntimeException ('DNS failed ' ));
293293 unset($ promise , $ dns );
294294
@@ -309,7 +309,7 @@ public function testRejectionAfterDnsLookupShouldNotCreateAnyGarbageReferences()
309309 $ tcp = new Deferred ();
310310 $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=example.com ' ))->willReturn ($ tcp ->promise ());
311311
312- $ promise = $ this ->connector ->connect ('example.com:80 ' );
312+ $ promise = $ this ->connector ->connect ('example.com:80 ' )-> then ( null , function () { }) ;
313313 $ dns ->resolve ('1.2.3.4 ' );
314314 $ tcp ->reject (new \RuntimeException ('Connection failed ' ));
315315 unset($ promise , $ dns , $ tcp );
@@ -334,7 +334,7 @@ public function testRejectionAfterDnsLookupShouldNotCreateAnyGarbageReferencesAg
334334 });
335335 $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=example.com ' ))->willReturn ($ tcp ->promise ());
336336
337- $ promise = $ this ->connector ->connect ('example.com:80 ' );
337+ $ promise = $ this ->connector ->connect ('example.com:80 ' )-> then ( null , function () { }) ;
338338 $ dns ->resolve ('1.2.3.4 ' );
339339
340340 unset($ promise , $ dns , $ tcp );
@@ -356,7 +356,7 @@ public function testCancelDuringDnsLookupShouldNotCreateAnyGarbageReferences()
356356 $ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ($ this ->equalTo ('example.com ' ))->willReturn ($ dns ->promise ());
357357 $ this ->tcp ->expects ($ this ->never ())->method ('connect ' );
358358
359- $ promise = $ this ->connector ->connect ('example.com:80 ' );
359+ $ promise = $ this ->connector ->connect ('example.com:80 ' )-> then ( null , function () { }) ;
360360
361361 $ promise ->cancel ();
362362 unset($ promise , $ dns );
@@ -379,7 +379,7 @@ public function testCancelDuringTcpConnectionShouldNotCreateAnyGarbageReferences
379379 });
380380 $ this ->tcp ->expects ($ this ->once ())->method ('connect ' )->with ($ this ->equalTo ('1.2.3.4:80?hostname=example.com ' ))->willReturn ($ tcp );
381381
382- $ promise = $ this ->connector ->connect ('example.com:80 ' );
382+ $ promise = $ this ->connector ->connect ('example.com:80 ' )-> then ( function () { }, function () { }) ;
383383 $ dns ->resolve ('1.2.3.4 ' );
384384
385385 $ promise ->cancel ();
0 commit comments