diff options
author | Yuchen Zeng <zyc@google.com> | 2016-07-21 16:15:12 -0700 |
---|---|---|
committer | Yuchen Zeng <zyc@google.com> | 2016-07-21 16:15:12 -0700 |
commit | 2edf5e904b5676807def8b1213476a76819267e1 (patch) | |
tree | f579465e62a89fa0e418f42badc52b278dac99ce /src/php/tests/unit_tests/CallTest.php | |
parent | 12c3811167fc33ab9921f14f00066da35a163b21 (diff) | |
parent | b8e26c021718758c2a0b2e73757580476d995498 (diff) |
Merge remote-tracking branch 'upstream/master' into seperate_generated_files
Diffstat (limited to 'src/php/tests/unit_tests/CallTest.php')
-rw-r--r--[-rwxr-xr-x] | src/php/tests/unit_tests/CallTest.php | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/php/tests/unit_tests/CallTest.php b/src/php/tests/unit_tests/CallTest.php index fa026f0935..d736f51546 100755..100644 --- a/src/php/tests/unit_tests/CallTest.php +++ b/src/php/tests/unit_tests/CallTest.php @@ -50,6 +50,18 @@ class CallTest extends PHPUnit_Framework_TestCase Grpc\Timeval::infFuture()); } + public function tearDown() + { + unset($this->call); + unset($this->channel); + } + + public function testConstructor() + { + $this->assertSame('Grpc\Call', get_class($this->call)); + $this->assertObjectHasAttribute('channel', $this->call); + } + public function testAddEmptyMetadata() { $batch = [ @@ -81,7 +93,8 @@ class CallTest extends PHPUnit_Framework_TestCase { $batch = [ Grpc\OP_SEND_INITIAL_METADATA => ['key1' => ['value1'], - 'key2' => ['value2', 'value3'], ], + 'key2' => ['value2', + 'value3'], ], ]; $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); @@ -118,4 +131,38 @@ class CallTest extends PHPUnit_Framework_TestCase ]; $result = $this->call->startBatch($batch); } + + /** + * @expectedException InvalidArgumentException + */ + public function testInvalidConstuctor() + { + $this->call = new Grpc\Call(); + $this->assertNull($this->call); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testInvalidConstuctor2() + { + $this->call = new Grpc\Call('hi', 'hi', 'hi'); + $this->assertNull($this->call); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testInvalidSetCredentials() + { + $this->call->setCredentials('hi'); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testInvalidSetCredentials2() + { + $this->call->setCredentials([]); + } } |