diff --git a/tests/ConnectionTest.php b/tests/ConnectionTest.php index bd20b4e..4942bf1 100644 --- a/tests/ConnectionTest.php +++ b/tests/ConnectionTest.php @@ -101,6 +101,38 @@ public function testWssCall() { $this->assertEquals(22222, $result['uid']); } + public function testHttpCallWithHeaders() { + $path = 'http://shop.textalk.se/backend/jsonrpc/v1'; + $options = array('headers' => array('foo' => 'bar', 'boo' => 'far')); + $connection = new Connection(array(), $path, $options); + $result = $connection->call('Webshop.get', array(22222, 'uid')); + $this->assertEquals(22222, $result['uid']); + } + + public function testHttpsCallWithHeaders() { + $path = 'https://shop.textalk.se/backend/jsonrpc/v1'; + $options = array('headers' => array('foo' => 'bar', 'boo' => 'far')); + $connection = new Connection(array(), $path, $options); + $result = $connection->call('Webshop.get', array(22222, 'uid')); + $this->assertEquals(22222, $result['uid']); + } + + public function testWsCallWithHeaders() { + $path = 'ws://shop.textalk.se/backend/jsonrpc/v1'; + $options = array('headers' => array('foo' => 'bar', 'boo' => 'far')); + $connection = new Connection(array(), $path, $options); + $result = $connection->call('Webshop.get', array(22222, 'uid')); + $this->assertEquals(22222, $result['uid']); + } + + public function testWssCallWithHeaders() { + $path = 'wss://shop.textalk.se/backend/jsonrpc/v1'; + $options = array('headers' => array('foo' => 'bar', 'boo' => 'far')); + $connection = new Connection(array(), $path, $options); + $result = $connection->call('Webshop.get', array(22222, 'uid')); + $this->assertEquals(22222, $result['uid']); + } + /** * @expectedException RuntimeException */