@@ -25,7 +25,14 @@ public function testCreateClient()
2525 $ capturedClient = Block \await ($ promise , $ this ->loop );
2626 $ this ->assertInstanceOf ('React\Datagram\Socket ' , $ capturedClient );
2727
28+ $ this ->assertEquals ('127.0.0.1:12345 ' , $ capturedClient ->getRemoteAddress ());
29+
30+ $ this ->assertContains ('127.0.0.1: ' , $ capturedClient ->getLocalAddress ());
31+ $ this ->assertNotEquals ('127.0.0.1:12345 ' , $ capturedClient ->getLocalAddress ());
32+
2833 $ capturedClient ->close ();
34+
35+ $ this ->assertNull ($ capturedClient ->getRemoteAddress ());
2936 }
3037
3138 public function testCreateClientLocalhost ()
@@ -35,6 +42,11 @@ public function testCreateClientLocalhost()
3542 $ capturedClient = Block \await ($ promise , $ this ->loop );
3643 $ this ->assertInstanceOf ('React\Datagram\Socket ' , $ capturedClient );
3744
45+ $ this ->assertEquals ('127.0.0.1:12345 ' , $ capturedClient ->getRemoteAddress ());
46+
47+ $ this ->assertContains ('127.0.0.1: ' , $ capturedClient ->getLocalAddress ());
48+ $ this ->assertNotEquals ('127.0.0.1:12345 ' , $ capturedClient ->getLocalAddress ());
49+
3850 $ capturedClient ->close ();
3951 }
4052
@@ -45,6 +57,11 @@ public function testCreateClientIpv6()
4557 $ capturedClient = Block \await ($ promise , $ this ->loop );
4658 $ this ->assertInstanceOf ('React\Datagram\Socket ' , $ capturedClient );
4759
60+ $ this ->assertEquals ('[::1]:12345 ' , $ capturedClient ->getRemoteAddress ());
61+
62+ $ this ->assertContains ('[::1]: ' , $ capturedClient ->getLocalAddress ());
63+ $ this ->assertNotEquals ('[::1]:12345 ' , $ capturedClient ->getLocalAddress ());
64+
4865 $ capturedClient ->close ();
4966 }
5067
@@ -55,7 +72,12 @@ public function testCreateServer()
5572 $ capturedServer = Block \await ($ promise , $ this ->loop );
5673 $ this ->assertInstanceOf ('React\Datagram\Socket ' , $ capturedServer );
5774
75+ $ this ->assertEquals ('127.0.0.1:12345 ' , $ capturedServer ->getLocalAddress ());
76+ $ this ->assertNull ($ capturedServer ->getRemoteAddress ());
77+
5878 $ capturedServer ->close ();
79+
80+ $ this ->assertNull ($ capturedServer ->getLocalAddress ());
5981 }
6082
6183 public function testCreateServerRandomPort ()
@@ -66,6 +88,7 @@ public function testCreateServerRandomPort()
6688 $ this ->assertInstanceOf ('React\Datagram\Socket ' , $ capturedServer );
6789
6890 $ this ->assertNotEquals ('127.0.0.1:0 ' , $ capturedServer ->getLocalAddress ());
91+ $ this ->assertNull ($ capturedServer ->getRemoteAddress ());
6992
7093 $ capturedServer ->close ();
7194 }
0 commit comments