@@ -50,6 +50,28 @@ public function testConstructorAcceptsUriWithPasswordWillPrefixSshCommandWithSsh
5050 $ this ->assertEquals ('exec sshpass -p \'pass \' ssh -v -o ExitOnForwardFailure=yes -N -D \'127.0.0.1:1080 \' \'user@host \'' , $ ref ->getValue ($ connector ));
5151 }
5252
53+ public function testConstructorAcceptsUriWithCustomBindUrl ()
54+ {
55+ $ loop = $ this ->getMockBuilder ('React\EventLoop\LoopInterface ' )->getMock ();
56+ $ connector = new SshSocksConnector ('host?bind=127.1.0.1:2711 ' , $ loop );
57+
58+ $ ref = new ReflectionProperty ($ connector , 'cmd ' );
59+ $ ref ->setAccessible (true );
60+
61+ $ this ->assertEquals ('exec ssh -v -o ExitOnForwardFailure=yes -N -o BatchMode=yes -D \'127.1.0.1:2711 \' \'host \'' , $ ref ->getValue ($ connector ));
62+ }
63+
64+ public function testConstructorAcceptsUriWithCustomBindUrlIpv6 ()
65+ {
66+ $ loop = $ this ->getMockBuilder ('React\EventLoop\LoopInterface ' )->getMock ();
67+ $ connector = new SshSocksConnector ('host?bind=[::1]:2711 ' , $ loop );
68+
69+ $ ref = new ReflectionProperty ($ connector , 'cmd ' );
70+ $ ref ->setAccessible (true );
71+
72+ $ this ->assertEquals ('exec ssh -v -o ExitOnForwardFailure=yes -N -o BatchMode=yes -D \'[::1]:2711 \' \'host \'' , $ ref ->getValue ($ connector ));
73+ }
74+
5375 /**
5476 * @expectedException InvalidArgumentException
5577 */
@@ -86,6 +108,15 @@ public function testConstructorThrowsForInvalidHost()
86108 new SshSocksConnector ('-host ' , $ loop );
87109 }
88110
111+ /**
112+ * @expectedException InvalidArgumentException
113+ */
114+ public function testConstructorThrowsForInvalidBindHost ()
115+ {
116+ $ loop = $ this ->getMockBuilder ('React\EventLoop\LoopInterface ' )->getMock ();
117+ new SshSocksConnector ('host?bind=example:1080 ' , $ loop );
118+ }
119+
89120 /**
90121 * @doesNotPerformAssertions
91122 */
0 commit comments