Imported Upstream version 1.37.1
[platform/upstream/grpc.git] / src / php / tests / unit_tests / ChannelTest.php
index a934106..b7df853 100644 (file)
@@ -52,7 +52,7 @@ class ChannelTest extends \PHPUnit\Framework\TestCase
         $this->assertNotNull($xdsCreds);
     }
 
-    public function testCreateXdsWithInsecure() {
+    public function disabled_testCreateXdsWithInsecure() {
         $xdsCreds = \Grpc\ChannelCredentials::createXds(
             \Grpc\ChannelCredentials::createInsecure()
         );
@@ -64,9 +64,21 @@ class ChannelTest extends \PHPUnit\Framework\TestCase
         $xdsCreds = \Grpc\ChannelCredentials::createXds(null);
     }
 
-    public function testCreateXdsWithInvalidType() {
-        $this->expectException(\TypeError::class);
-        $xdsCreds = \Grpc\ChannelCredentials::createXds("invalid-type");
+    public function testCreateXdsWithInvalidType()
+    {
+        $expected = $this->logicalOr(
+            // PHP8
+            new \PHPUnit\Framework\Constraint\Exception(\InvalidArgumentException::class),
+            // PHP7
+            new \PHPUnit\Framework\Constraint\Exception(\TypeError::class)
+        );
+        try {
+            $xdsCreds = \Grpc\ChannelCredentials::createXds("invalid-type");
+        } catch (\Throwable $exception) {
+            $this->assertThat($exception, $expected);
+            return;
+        }
+        $this->assertThat(null, $expected);
     }
 
     public function testGetConnectivityState()
@@ -353,6 +365,7 @@ class ChannelTest extends \PHPUnit\Framework\TestCase
                 ),
                 50306,
             ],
+            /*
             [
                 \Grpc\ChannelCredentials::createXds(
                     \Grpc\ChannelCredentials::createInSecure()
@@ -362,6 +375,7 @@ class ChannelTest extends \PHPUnit\Framework\TestCase
                 ),
                 50307,
             ],
+            */
         ];
     }
 
@@ -424,6 +438,7 @@ class ChannelTest extends \PHPUnit\Framework\TestCase
                 ),
                 50353,
             ],
+            /*
             [
                 \Grpc\ChannelCredentials::createXds(
                     \Grpc\ChannelCredentials::createSsl()
@@ -440,6 +455,7 @@ class ChannelTest extends \PHPUnit\Framework\TestCase
                 ),
                 50355,
             ],
+            */
             [
                 \Grpc\ChannelCredentials::createSsl(),
                 \Grpc\ChannelCredentials::createXds(