diff options
author | 2017-08-22 13:15:01 -0700 | |
---|---|---|
committer | 2017-08-22 13:18:14 -0700 | |
commit | 5d55948c342282145004bc345df8f6bd58d2f2be (patch) | |
tree | 90c5b7395802b4adc51214e64992a2a8787a3fcf /src/php/tests/unit_tests/ChannelTest.php | |
parent | 72827fb8beabc0cf3e6cf669da580ab7c13c53c2 (diff) |
PHP: upmerge from 1.4.x branch
Diffstat (limited to 'src/php/tests/unit_tests/ChannelTest.php')
-rw-r--r-- | src/php/tests/unit_tests/ChannelTest.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/php/tests/unit_tests/ChannelTest.php b/src/php/tests/unit_tests/ChannelTest.php index 400df0fb66..c375a16269 100644 --- a/src/php/tests/unit_tests/ChannelTest.php +++ b/src/php/tests/unit_tests/ChannelTest.php @@ -517,8 +517,6 @@ class ChannelTest extends PHPUnit_Framework_TestCase $state = $this->channel2->getConnectivityState(); $this->assertEquals(GRPC\CHANNEL_IDLE, $state); - // any dangling old connection to the same host must be - // manually closed $this->channel1->close(); $this->channel2->close(); } @@ -529,6 +527,7 @@ class ChannelTest extends PHPUnit_Framework_TestCase $this->channel1 = new Grpc\Channel('localhost:1', []); $this->channel2 = new Grpc\Channel('localhost:1', ["force_new" => true]); + // channel3 shares with channel1 $this->channel3 = new Grpc\Channel('localhost:1', []); // try to connect on channel2 @@ -540,29 +539,31 @@ class ChannelTest extends PHPUnit_Framework_TestCase $state = $this->channel2->getConnectivityState(); $this->assertConnecting($state); $state = $this->channel3->getConnectivityState(); - $this->assertConnecting($state); + $this->assertEquals(GRPC\CHANNEL_IDLE, $state); $this->channel1->close(); $this->channel2->close(); } + /** + * @expectedException RuntimeException + */ public function testPersistentChannelForceNewOldChannelClose() { $this->channel1 = new Grpc\Channel('localhost:1', []); $this->channel2 = new Grpc\Channel('localhost:1', ["force_new" => true]); + // channel3 shares with channel1 $this->channel3 = new Grpc\Channel('localhost:1', []); $this->channel1->close(); $state = $this->channel2->getConnectivityState(); $this->assertEquals(GRPC\CHANNEL_IDLE, $state); - $state = $this->channel3->getConnectivityState(); - $this->assertEquals(GRPC\CHANNEL_IDLE, $state); - $this->channel2->close(); - $this->channel3->close(); + // channel3 already closed + $state = $this->channel3->getConnectivityState(); } public function testPersistentChannelForceNewNewChannelClose() |