@@ -29,7 +29,7 @@ class RemoteObjectTest extends TestCase
2929 public function testCallFunction (): void
3030 {
3131 run (function () {
32- $ client = new RemoteObject \ Client ( ' 127.0.0.1 ' , RemoteObject \Server:: DEFAULT_PORT );
32+ $ client = swoole_get_default_remote_object_client ( );
3333 $ this ->assertEquals ('x86_64 ' , $ client ->call ('php_uname ' , 'm ' ));
3434 $ gd_info = $ client ->call ('gd_info ' );
3535 $ this ->assertIsArray ($ gd_info );
@@ -40,7 +40,7 @@ public function testCallFunction(): void
4040 public function testInvoke ()
4141 {
4242 run (function () {
43- $ client = new RemoteObject \ Client ( ' 127.0.0.1 ' , RemoteObject \Server:: DEFAULT_PORT );
43+ $ client = swoole_get_default_remote_object_client ( );
4444 $ o = $ client ->create (\Greeter::class, 'Hello swoole ' );
4545 $ this ->assertEquals ('Hello swoole, my name is Tianfeng.Han! ' , $ o ('my name is Tianfeng.Han ' ));
4646 });
@@ -49,7 +49,7 @@ public function testInvoke()
4949 public function testIterator ()
5050 {
5151 run (function () {
52- $ client = new RemoteObject \ Client ( ' 127.0.0.1 ' , RemoteObject \Server:: DEFAULT_PORT );
52+ $ client = swoole_get_default_remote_object_client ( );
5353 $ o = $ client ->create (\Greeter::class, 'hello swoole ' );
5454 $ list = iterator_to_array ($ o );
5555 $ this ->assertEquals ($ list , $ o ->list );
@@ -60,7 +60,7 @@ public function testIterator()
6060 public function testResource ()
6161 {
6262 run (function () {
63- $ client = new RemoteObject \ Client ( ' 127.0.0.1 ' , RemoteObject \Server:: DEFAULT_PORT );
63+ $ client = swoole_get_default_remote_object_client ( );
6464 $ fp = $ client ->call ('fopen ' , '/tmp/data.txt ' , 'w ' );
6565
6666 $ n = random_int (1024 , 65536 );
@@ -85,7 +85,7 @@ public function testMongoDb(): void
8585
8686 public function __construct ()
8787 {
88- $ this ->roClient = new RemoteObject \ Client ();
88+ $ this ->roClient = swoole_get_default_remote_object_client ();
8989 $ client = $ this ->roClient ->create (\MongoDB \Client::class, MONGODB_SERVER_URL );
9090 $ this ->collection = $ client ->myDatabase ->users ;
9191 }
0 commit comments