@@ -20,13 +20,11 @@ class FunctionalConnectorTest extends TestCase
2020 /** @test */
2121 public function connectionToTcpServerShouldSucceedWithLocalhost ()
2222 {
23- $ loop = Loop::get ();
24-
2523 $ server = new TcpServer (9998 );
2624
2725 $ connector = new Connector (array ());
2826
29- $ connection = Block \await ($ connector ->connect ('localhost:9998 ' ), $ loop , self ::TIMEOUT );
27+ $ connection = Block \await ($ connector ->connect ('localhost:9998 ' ), null , self ::TIMEOUT );
3028
3129 $ server ->close ();
3230
@@ -65,11 +63,11 @@ public function testConnectTwiceWithoutHappyEyeBallsOnlySendsSingleDnsQueryDueTo
6563 fclose ($ client );
6664 });
6765
68- $ connection = Block \await ($ connector ->connect ('example.com:80 ' ), Loop:: get () );
66+ $ connection = Block \await ($ connector ->connect ('example.com:80 ' ));
6967 $ connection ->close ();
7068 $ this ->assertEquals (1 , $ received );
7169
72- $ connection = Block \await ($ connector ->connect ('example.com:80 ' ), Loop:: get () );
70+ $ connection = Block \await ($ connector ->connect ('example.com:80 ' ));
7371 $ connection ->close ();
7472 $ this ->assertEquals (1 , $ received );
7573
@@ -85,11 +83,9 @@ public function connectionToRemoteTCP4n6ServerShouldResultInOurIP()
8583 // max_nesting_level was set to 100 for PHP Versions < 5.4 which resulted in failing test for legacy PHP
8684 ini_set ('xdebug.max_nesting_level ' , 256 );
8785
88- $ loop = Loop::get ();
89-
9086 $ connector = new Connector (array ('happy_eyeballs ' => true ));
9187
92- $ ip = Block \await ($ this ->request ('dual.tlund.se ' , $ connector ), $ loop , self ::TIMEOUT );
88+ $ ip = Block \await ($ this ->request ('dual.tlund.se ' , $ connector ), null , self ::TIMEOUT );
9389
9490 $ this ->assertNotFalse (inet_pton ($ ip ));
9591 }
@@ -100,12 +96,10 @@ public function connectionToRemoteTCP4n6ServerShouldResultInOurIP()
10096 */
10197 public function connectionToRemoteTCP4ServerShouldResultInOurIP ()
10298 {
103- $ loop = Loop::get ();
104-
10599 $ connector = new Connector (array ('happy_eyeballs ' => true ));
106100
107101 try {
108- $ ip = Block \await ($ this ->request ('ipv4.tlund.se ' , $ connector ), $ loop , self ::TIMEOUT );
102+ $ ip = Block \await ($ this ->request ('ipv4.tlund.se ' , $ connector ), null , self ::TIMEOUT );
109103 } catch (\Exception $ e ) {
110104 $ this ->checkIpv4 ();
111105 throw $ e ;
@@ -121,12 +115,10 @@ public function connectionToRemoteTCP4ServerShouldResultInOurIP()
121115 */
122116 public function connectionToRemoteTCP6ServerShouldResultInOurIP ()
123117 {
124- $ loop = Loop::get ();
125-
126118 $ connector = new Connector (array ('happy_eyeballs ' => true ));
127119
128120 try {
129- $ ip = Block \await ($ this ->request ('ipv6.tlund.se ' , $ connector ), $ loop , self ::TIMEOUT );
121+ $ ip = Block \await ($ this ->request ('ipv6.tlund.se ' , $ connector ), null , self ::TIMEOUT );
130122 } catch (\Exception $ e ) {
131123 $ this ->checkIpv6 ();
132124 throw $ e ;
@@ -142,30 +134,28 @@ public function testCancelPendingTlsConnectionDuringTlsHandshakeShouldCloseTcpCo
142134 $ this ->markTestSkipped ('Not supported on legacy HHVM ' );
143135 }
144136
145- $ loop = Loop::get ();
146-
147137 $ server = new TcpServer (0 );
148138 $ uri = str_replace ('tcp:// ' , 'tls:// ' , $ server ->getAddress ());
149139
150140 $ connector = new Connector (array ());
151141 $ promise = $ connector ->connect ($ uri );
152142
153143 $ deferred = new Deferred ();
154- $ server ->on ('connection ' , function (ConnectionInterface $ connection ) use ($ promise , $ deferred, $ loop ) {
144+ $ server ->on ('connection ' , function (ConnectionInterface $ connection ) use ($ promise , $ deferred ) {
155145 $ connection ->on ('close ' , function () use ($ deferred ) {
156146 $ deferred ->resolve ();
157147 });
158148
159- $ loop -> futureTick (function () use ($ promise ) {
149+ Loop:: futureTick (function () use ($ promise ) {
160150 $ promise ->cancel ();
161151 });
162152 });
163153
164- Block \await ($ deferred ->promise (), $ loop , self ::TIMEOUT );
154+ Block \await ($ deferred ->promise (), null , self ::TIMEOUT );
165155 $ server ->close ();
166156
167157 try {
168- Block \await ($ promise , $ loop , self ::TIMEOUT );
158+ Block \await ($ promise , null , self ::TIMEOUT );
169159 $ this ->fail ();
170160 } catch (\Exception $ e ) {
171161 $ this ->assertInstanceOf ('RuntimeException ' , $ e );
0 commit comments