11<?php
22
33use React \Datagram \Socket ;
4+ use Clue \React \Block ;
45
56class SocketTest extends TestCase
67{
@@ -15,7 +16,7 @@ public function setUp()
1516 public function testCreateClientCloseWillNotBlock ()
1617 {
1718 $ promise = $ this ->factory ->createClient ('127.0.0.1:12345 ' );
18- $ client = $ this ->getValueFromResolvedPromise ( $ promise );
19+ $ client = Block \await ( $ promise , $ this ->loop );
1920
2021 $ client ->send ('test ' );
2122 $ client ->close ();
@@ -39,7 +40,7 @@ public function testClientCloseAgainWillNotBlock(Socket $client)
3940 public function testCreateClientEndWillNotBlock ()
4041 {
4142 $ promise = $ this ->factory ->createClient ('127.0.0.1:12345 ' );
42- $ client = $ this ->getValueFromResolvedPromise ( $ promise );
43+ $ client = Block \await ( $ promise , $ this ->loop );
4344
4445 $ client ->send ('test ' );
4546 $ client ->end ();
@@ -76,7 +77,7 @@ public function testClientSendAfterEndIsNoop(Socket $client)
7677 public function testClientSendHugeWillFail ()
7778 {
7879 $ promise = $ this ->factory ->createClient ('127.0.0.1:12345 ' );
79- $ client = $ this ->getValueFromResolvedPromise ( $ promise );
80+ $ client = Block \await ( $ promise , $ this ->loop );
8081
8182 $ client ->send (str_repeat (1 , 1024 * 1024 ));
8283 $ client ->on ('error ' , $ this ->expectCallableOnce ());
@@ -88,7 +89,7 @@ public function testClientSendHugeWillFail()
8889 public function testClientSendNoServerWillFail ()
8990 {
9091 $ promise = $ this ->factory ->createClient ('127.0.0.1:1234 ' );
91- $ client = $ this ->getValueFromResolvedPromise ( $ promise );
92+ $ client = Block \await ( $ promise , $ this ->loop );
9293
9394 // send a message to a socket that is not actually listening
9495 // expect the remote end to reject this by sending an ICMP message
@@ -114,10 +115,10 @@ public function testClientSendNoServerWillFail()
114115 public function testCreatePair ()
115116 {
116117 $ promise = $ this ->factory ->createServer ('127.0.0.1:0 ' );
117- $ server = $ this ->getValueFromResolvedPromise ( $ promise );
118+ $ server = Block \await ( $ promise , $ this ->loop );
118119
119120 $ promise = $ this ->factory ->createClient ($ server ->getLocalAddress ());
120- $ client = $ this ->getValueFromResolvedPromise ( $ promise );
121+ $ client = Block \await ( $ promise , $ this ->loop );
121122
122123 $ that = $ this ;
123124 $ server ->on ('message ' , function ($ message , $ remote , $ server ) use ($ that ) {
@@ -158,10 +159,10 @@ public function provideSanitizeAddress()
158159 public function testSanitizeAddress ($ address )
159160 {
160161 $ promise = $ this ->factory ->createServer ($ address );
161- $ server = $ this ->getValueFromResolvedPromise ( $ promise );
162-
162+ $ server = Block \await ( $ promise , $ this ->loop );
163+
163164 $ promise = $ this ->factory ->createClient ($ server ->getLocalAddress ());
164- $ client = $ this ->getValueFromResolvedPromise ( $ promise );
165+ $ client = Block \await ( $ promise , $ this ->loop );
165166
166167 $ that = $ this ;
167168 $ server ->on ('message ' , function ($ message , $ remote , $ server ) use ($ that ) {
0 commit comments