2
2
3
3
namespace React \Tests \Datagram ;
4
4
5
- use Clue \React \Block ;
6
5
use React \Datagram \Factory ;
7
6
use React \Datagram \Socket ;
8
7
use React \Promise ;
@@ -40,7 +39,7 @@ public function testCreateClient()
40
39
41
40
$ promise = $ this ->factory ->createClient ('127.0.0.1:12345 ' );
42
41
43
- $ capturedClient = Block \ await ($ promise, $ this -> loop );
42
+ $ capturedClient = \ React \ Async \ await ($ promise );
44
43
$ this ->assertInstanceOf ('React\Datagram\Socket ' , $ capturedClient );
45
44
46
45
$ this ->assertEquals ('127.0.0.1:12345 ' , $ capturedClient ->getRemoteAddress ());
@@ -59,7 +58,7 @@ public function testCreateClientLocalhost()
59
58
60
59
$ promise = $ this ->factory ->createClient ('localhost:12345 ' );
61
60
62
- $ capturedClient = Block \ await ($ promise, $ this -> loop );
61
+ $ capturedClient = \ React \ Async \ await ($ promise );
63
62
$ this ->assertInstanceOf ('React\Datagram\Socket ' , $ capturedClient );
64
63
65
64
$ this ->assertEquals ('127.0.0.1:12345 ' , $ capturedClient ->getRemoteAddress ());
@@ -77,7 +76,7 @@ public function testCreateClientLocalhostWithDefaultResolver()
77
76
78
77
$ promise = $ this ->factory ->createClient ('localhost:12345 ' );
79
78
80
- $ capturedClient = Block \ await ($ promise, $ this -> loop );
79
+ $ capturedClient = \ React \ Async \ await ($ promise );
81
80
$ this ->assertInstanceOf ('React\Datagram\SocketInterface ' , $ capturedClient );
82
81
83
82
$ capturedClient ->close ();
@@ -88,7 +87,7 @@ public function testCreateClientIpv6()
88
87
$ promise = $ this ->factory ->createClient ('[::1]:12345 ' );
89
88
90
89
try {
91
- $ capturedClient = Block \ await ($ promise, $ this -> loop );
90
+ $ capturedClient = \ React \ Async \ await ($ promise );
92
91
} catch (\Exception $ e ) {
93
92
$ this ->markTestSkipped ('Unable to start IPv6 client socket (IPv6 not supported on this system?) ' );
94
93
}
@@ -107,7 +106,7 @@ public function testCreateServer()
107
106
{
108
107
$ promise = $ this ->factory ->createServer ('127.0.0.1:12345 ' );
109
108
110
- $ capturedServer = Block \ await ($ promise, $ this -> loop );
109
+ $ capturedServer = \ React \ Async \ await ($ promise );
111
110
$ this ->assertInstanceOf ('React\Datagram\Socket ' , $ capturedServer );
112
111
113
112
$ this ->assertEquals ('127.0.0.1:12345 ' , $ capturedServer ->getLocalAddress ());
@@ -122,7 +121,7 @@ public function testCreateServerRandomPort()
122
121
{
123
122
$ promise = $ this ->factory ->createServer ('127.0.0.1:0 ' );
124
123
125
- $ capturedServer = Block \ await ($ promise, $ this -> loop );
124
+ $ capturedServer = \ React \ Async \ await ($ promise );
126
125
$ this ->assertInstanceOf ('React\Datagram\Socket ' , $ capturedServer );
127
126
128
127
$ this ->assertNotEquals ('127.0.0.1:0 ' , $ capturedServer ->getLocalAddress ());
@@ -135,15 +134,15 @@ public function testCreateClientWithIpWillNotUseResolver()
135
134
{
136
135
$ this ->resolver ->expects ($ this ->never ())->method ('resolve ' );
137
136
138
- $ client = Block \ await ($ this ->factory ->createClient ('127.0.0.1:0 ' ), $ this -> loop );
137
+ $ client = \ React \ Async \ await ($ this ->factory ->createClient ('127.0.0.1:0 ' ));
139
138
$ client ->close ();
140
139
}
141
140
142
141
public function testCreateClientWithHostnameWillUseResolver ()
143
142
{
144
143
$ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ('example.com ' )->willReturn (Promise \resolve ('127.0.0.1 ' ));
145
144
146
- $ client = Block \ await ($ this ->factory ->createClient ('example.com:0 ' ), $ this -> loop );
145
+ $ client = \ React \ Async \ await ($ this ->factory ->createClient ('example.com:0 ' ));
147
146
$ client ->close ();
148
147
}
149
148
@@ -152,19 +151,19 @@ public function testCreateClientWithHostnameWillRejectIfResolverRejects()
152
151
$ this ->resolver ->expects ($ this ->once ())->method ('resolve ' )->with ('example.com ' )->willReturn (Promise \reject (new \RuntimeException ('test ' )));
153
152
154
153
$ this ->setExpectedException ('RuntimeException ' );
155
- Block \ await ($ this ->factory ->createClient ('example.com:0 ' ), $ this -> loop );
154
+ \ React \ Async \ await ($ this ->factory ->createClient ('example.com:0 ' ));
156
155
}
157
156
158
157
public function testCreateClientWithInvalidHostnameWillReject ()
159
158
{
160
159
$ this ->setExpectedException ('Exception ' , 'Unable to create client socket ' );
161
- Block \ await ($ this ->factory ->createClient ('///// ' ), $ this -> loop );
160
+ \ React \ Async \ await ($ this ->factory ->createClient ('///// ' ));
162
161
}
163
162
164
163
public function testCreateServerWithInvalidHostnameWillReject ()
165
164
{
166
165
$ this ->setExpectedException ('Exception ' , 'Unable to create server socket ' );
167
- Block \ await ($ this ->factory ->createServer ('///// ' ), $ this -> loop );
166
+ \ React \ Async \ await ($ this ->factory ->createServer ('///// ' ));
168
167
}
169
168
170
169
public function testCancelCreateClientWithCancellableHostnameResolver ()
@@ -176,7 +175,7 @@ public function testCancelCreateClientWithCancellableHostnameResolver()
176
175
$ promise ->cancel ();
177
176
178
177
$ this ->setExpectedException ('RuntimeException ' );
179
- Block \ await ($ promise, $ this -> loop );
178
+ \ React \ Async \ await ($ promise );
180
179
}
181
180
182
181
public function testCancelCreateClientWithUncancellableHostnameResolver ()
@@ -188,6 +187,6 @@ public function testCancelCreateClientWithUncancellableHostnameResolver()
188
187
$ promise ->cancel ();
189
188
190
189
$ this ->setExpectedException ('RuntimeException ' );
191
- Block \ await ($ promise, $ this -> loop );
190
+ \ React \ Async \ await ($ promise );
192
191
}
193
192
}
0 commit comments