@@ -12,7 +12,9 @@ public function testConstructWithoutLoopAssignsLoopAutomatically()
1212 $ connector = new SshSocksConnector ('host ' );
1313
1414 $ ref = new \ReflectionProperty ($ connector , 'loop ' );
15- $ ref ->setAccessible (true );
15+ if (PHP_VERSION_ID < 80100 ) {
16+ $ ref ->setAccessible (true );
17+ }
1618 $ loop = $ ref ->getValue ($ connector );
1719
1820 $ this ->assertInstanceOf ('React\EventLoop\LoopInterface ' , $ loop );
@@ -24,7 +26,9 @@ public function testConstructorAcceptsUri()
2426 $ connector = new SshSocksConnector ('host ' , $ loop );
2527
2628 $ ref = new \ReflectionProperty ($ connector , 'cmd ' );
27- $ ref ->setAccessible (true );
29+ if (PHP_VERSION_ID < 80100 ) {
30+ $ ref ->setAccessible (true );
31+ }
2832
2933 $ this ->assertEquals ('exec ssh -v -o ExitOnForwardFailure=yes -N -o BatchMode=yes -D \'127.0.0.1:1080 \' \'host \'' , $ ref ->getValue ($ connector ));
3034 }
@@ -35,7 +39,9 @@ public function testConstructorAcceptsUriWithDefaultPortWillNotBeAddedToCommand(
3539 $ connector = new SshSocksConnector ('host:22 ' , $ loop );
3640
3741 $ ref = new \ReflectionProperty ($ connector , 'cmd ' );
38- $ ref ->setAccessible (true );
42+ if (PHP_VERSION_ID < 80100 ) {
43+ $ ref ->setAccessible (true );
44+ }
3945
4046 $ this ->assertEquals ('exec ssh -v -o ExitOnForwardFailure=yes -N -o BatchMode=yes -D \'127.0.0.1:1080 \' \'host \'' , $ ref ->getValue ($ connector ));
4147 }
@@ -46,7 +52,9 @@ public function testConstructorAcceptsUriWithUserAndCustomPort()
4652 $ connector = new SshSocksConnector ('user@host:2222 ' , $ loop );
4753
4854 $ ref = new \ReflectionProperty ($ connector , 'cmd ' );
49- $ ref ->setAccessible (true );
55+ if (PHP_VERSION_ID < 80100 ) {
56+ $ ref ->setAccessible (true );
57+ }
5058
5159 $ this ->assertEquals ('exec ssh -v -o ExitOnForwardFailure=yes -N -o BatchMode=yes -p 2222 -D \'127.0.0.1:1080 \' \'user@host \'' , $ ref ->getValue ($ connector ));
5260 }
@@ -57,7 +65,9 @@ public function testConstructorAcceptsUriWithPasswordWillPrefixSshCommandWithSsh
5765 $ connector = new SshSocksConnector ('user:pass@host ' , $ loop );
5866
5967 $ ref = new \ReflectionProperty ($ connector , 'cmd ' );
60- $ ref ->setAccessible (true );
68+ if (PHP_VERSION_ID < 80100 ) {
69+ $ ref ->setAccessible (true );
70+ }
6171
6272 $ this ->assertEquals ('exec sshpass -p \'pass \' ssh -v -o ExitOnForwardFailure=yes -N -D \'127.0.0.1:1080 \' \'user@host \'' , $ ref ->getValue ($ connector ));
6373 }
@@ -68,7 +78,9 @@ public function testConstructorAcceptsUriWithCustomBindUrl()
6878 $ connector = new SshSocksConnector ('host?bind=127.1.0.1:2711 ' , $ loop );
6979
7080 $ ref = new \ReflectionProperty ($ connector , 'cmd ' );
71- $ ref ->setAccessible (true );
81+ if (PHP_VERSION_ID < 80100 ) {
82+ $ ref ->setAccessible (true );
83+ }
7284
7385 $ this ->assertEquals ('exec ssh -v -o ExitOnForwardFailure=yes -N -o BatchMode=yes -D \'127.1.0.1:2711 \' \'host \'' , $ ref ->getValue ($ connector ));
7486 }
@@ -79,7 +91,9 @@ public function testConstructorAcceptsUriWithCustomBindUrlIpv6()
7991 $ connector = new SshSocksConnector ('host?bind=[::1]:2711 ' , $ loop );
8092
8193 $ ref = new \ReflectionProperty ($ connector , 'cmd ' );
82- $ ref ->setAccessible (true );
94+ if (PHP_VERSION_ID < 80100 ) {
95+ $ ref ->setAccessible (true );
96+ }
8397
8498 $ this ->assertEquals ('exec ssh -v -o ExitOnForwardFailure=yes -N -o BatchMode=yes -D \'[::1]:2711 \' \'host \'' , $ ref ->getValue ($ connector ));
8599 }
@@ -200,7 +214,9 @@ public function testConnectWillCancelPendingIdleTimerAndWaitForSshListener()
200214
201215 $ timer = $ this ->getMockBuilder ('React\EventLoop\TimerInterface ' )->getMock ();
202216 $ ref = new \ReflectionProperty ($ connector , 'idleTimer ' );
203- $ ref ->setAccessible (true );
217+ if (PHP_VERSION_ID < 80100 ) {
218+ $ ref ->setAccessible (true );
219+ }
204220 $ ref ->setValue ($ connector , $ timer );
205221
206222 $ connector ->connect ('google.com:80 ' );
@@ -214,7 +230,9 @@ public function testConnectWithFailingSshListenerShouldReturnRejectedPromise()
214230
215231 $ deferred = new Deferred ();
216232 $ ref = new \ReflectionProperty ($ connector , 'listen ' );
217- $ ref ->setAccessible (true );
233+ if (PHP_VERSION_ID < 80100 ) {
234+ $ ref ->setAccessible (true );
235+ }
218236 $ ref ->setValue ($ connector , $ deferred ->promise ());
219237
220238 $ promise = $ connector ->connect ('google.com:80 ' );
@@ -238,7 +256,9 @@ public function testConnectTwiceWithFailingSshListenerShouldRejectBothPromises()
238256
239257 $ deferred = new Deferred ();
240258 $ ref = new \ReflectionProperty ($ connector , 'listen ' );
241- $ ref ->setAccessible (true );
259+ if (PHP_VERSION_ID < 80100 ) {
260+ $ ref ->setAccessible (true );
261+ }
242262 $ ref ->setValue ($ connector , $ deferred ->promise ());
243263
244264 $ first = $ connector ->connect ('google.com:80 ' );
@@ -259,7 +279,9 @@ public function testConnectCancellationWithFailingSshListenerShouldAddTimerOnce(
259279
260280 $ deferred = new Deferred ();
261281 $ ref = new \ReflectionProperty ($ connector , 'listen ' );
262- $ ref ->setAccessible (true );
282+ if (PHP_VERSION_ID < 80100 ) {
283+ $ ref ->setAccessible (true );
284+ }
263285 $ ref ->setValue ($ connector , $ deferred ->promise ());
264286
265287 $ promise = $ connector ->connect ('google.com:80 ' );
@@ -275,15 +297,19 @@ public function testConnectWithSuccessfulSshListenerWillInvokeSocksConnector()
275297 $ connector = new SshSocksConnector ('host ' , $ loop );
276298
277299 $ ref = new \ReflectionProperty ($ connector , 'listen ' );
278- $ ref ->setAccessible (true );
300+ if (PHP_VERSION_ID < 80100 ) {
301+ $ ref ->setAccessible (true );
302+ }
279303 $ ref ->setValue ($ connector , \React \Promise \resolve (null ));
280304
281305 $ deferred = new Deferred ();
282306 $ socks = $ this ->getMockBuilder ('React\Socket\ConnectorInterface ' )->getMock ();
283307 $ socks ->expects ($ this ->once ())->method ('connect ' )->with ('google.com:80 ' )->willReturn ($ deferred ->promise ());
284308
285309 $ ref = new \ReflectionProperty ($ connector , 'socks ' );
286- $ ref ->setAccessible (true );
310+ if (PHP_VERSION_ID < 80100 ) {
311+ $ ref ->setAccessible (true );
312+ }
287313 $ ref ->setValue ($ connector , $ socks );
288314
289315 $ promise = $ connector ->connect ('google.com:80 ' );
@@ -297,7 +323,9 @@ public function testConnectCancellationWithSuccessfulSshListenerWillCancelSocksC
297323 $ connector = new SshSocksConnector ('host ' , $ loop );
298324
299325 $ ref = new \ReflectionProperty ($ connector , 'listen ' );
300- $ ref ->setAccessible (true );
326+ if (PHP_VERSION_ID < 80100 ) {
327+ $ ref ->setAccessible (true );
328+ }
301329 $ ref ->setValue ($ connector , \React \Promise \resolve (null ));
302330
303331 $ deferred = new Deferred (function () {
@@ -307,7 +335,9 @@ public function testConnectCancellationWithSuccessfulSshListenerWillCancelSocksC
307335 $ socks ->expects ($ this ->once ())->method ('connect ' )->willReturn ($ deferred ->promise ());
308336
309337 $ ref = new \ReflectionProperty ($ connector , 'socks ' );
310- $ ref ->setAccessible (true );
338+ if (PHP_VERSION_ID < 80100 ) {
339+ $ ref ->setAccessible (true );
340+ }
311341 $ ref ->setValue ($ connector , $ socks );
312342
313343 $ promise = $ connector ->connect ('google.com:80 ' );
@@ -330,15 +360,19 @@ public function testConnectWithSuccessfulSshListenerButFailingSocksConnectorShou
330360 $ connector = new SshSocksConnector ('host ' , $ loop );
331361
332362 $ ref = new \ReflectionProperty ($ connector , 'listen ' );
333- $ ref ->setAccessible (true );
363+ if (PHP_VERSION_ID < 80100 ) {
364+ $ ref ->setAccessible (true );
365+ }
334366 $ ref ->setValue ($ connector , \React \Promise \resolve (null ));
335367
336368 $ deferred = new Deferred ();
337369 $ socks = $ this ->getMockBuilder ('React\Socket\ConnectorInterface ' )->getMock ();
338370 $ socks ->expects ($ this ->once ())->method ('connect ' )->willReturn ($ deferred ->promise ());
339371
340372 $ ref = new \ReflectionProperty ($ connector , 'socks ' );
341- $ ref ->setAccessible (true );
373+ if (PHP_VERSION_ID < 80100 ) {
374+ $ ref ->setAccessible (true );
375+ }
342376 $ ref ->setValue ($ connector , $ socks );
343377
344378 $ promise = $ connector ->connect ('google.com:80 ' );
@@ -361,7 +395,9 @@ public function testConnectWithSuccessfulSshListenerAndSuccessfulSocksConnectorS
361395 $ connector = new SshSocksConnector ('host ' , $ loop );
362396
363397 $ ref = new \ReflectionProperty ($ connector , 'listen ' );
364- $ ref ->setAccessible (true );
398+ if (PHP_VERSION_ID < 80100 ) {
399+ $ ref ->setAccessible (true );
400+ }
365401 $ ref ->setValue ($ connector , \React \Promise \resolve (null ));
366402
367403 $ connection = $ this ->getMockBuilder ('React\Socket\ConnectionInterface ' )->getMock ();
@@ -372,7 +408,9 @@ public function testConnectWithSuccessfulSshListenerAndSuccessfulSocksConnectorS
372408 $ socks ->expects ($ this ->once ())->method ('connect ' )->willReturn ($ deferred ->promise ());
373409
374410 $ ref = new \ReflectionProperty ($ connector , 'socks ' );
375- $ ref ->setAccessible (true );
411+ if (PHP_VERSION_ID < 80100 ) {
412+ $ ref ->setAccessible (true );
413+ }
376414 $ ref ->setValue ($ connector , $ socks );
377415
378416 $ promise = $ connector ->connect ('google.com:80 ' );
@@ -388,7 +426,9 @@ public function testConnectWithSuccessfulSshListenerAndSuccessfulSocksConnectorW
388426 $ connector = new SshSocksConnector ('host ' , $ loop );
389427
390428 $ ref = new \ReflectionProperty ($ connector , 'listen ' );
391- $ ref ->setAccessible (true );
429+ if (PHP_VERSION_ID < 80100 ) {
430+ $ ref ->setAccessible (true );
431+ }
392432 $ ref ->setValue ($ connector , \React \Promise \resolve (null ));
393433
394434 $ connection = $ this ->getMockBuilder ('React\Socket\Connection ' )->disableOriginalConstructor ()->setMethods (array ('close ' ))->getMock ();
@@ -399,7 +439,9 @@ public function testConnectWithSuccessfulSshListenerAndSuccessfulSocksConnectorW
399439 $ socks ->expects ($ this ->once ())->method ('connect ' )->willReturn ($ deferred ->promise ());
400440
401441 $ ref = new \ReflectionProperty ($ connector , 'socks ' );
402- $ ref ->setAccessible (true );
442+ if (PHP_VERSION_ID < 80100 ) {
443+ $ ref ->setAccessible (true );
444+ }
403445 $ ref ->setValue ($ connector , $ socks );
404446
405447 $ promise = $ connector ->connect ('google.com:80 ' );
0 commit comments