Skip to content

Commit ead4bd3

Browse files
author
Sören
committed
Tests with header options.
1 parent 9b3fd39 commit ead4bd3

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/ConnectionTest.php

+32
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,38 @@ public function testWssCall() {
101101
$this->assertEquals(22222, $result['uid']);
102102
}
103103

104+
public function testHttpCallWithHeaders() {
105+
$path = 'http://shop.textalk.se/backend/jsonrpc/v1';
106+
$options = array('headers' => array('foo' => 'bar', 'boo' => 'far'));
107+
$connection = new Connection(array(), $path, $options);
108+
$result = $connection->call('Webshop.get', array(22222, 'uid'));
109+
$this->assertEquals(22222, $result['uid']);
110+
}
111+
112+
public function testHttpsCallWithHeaders() {
113+
$path = 'https://shop.textalk.se/backend/jsonrpc/v1';
114+
$options = array('headers' => array('foo' => 'bar', 'boo' => 'far'));
115+
$connection = new Connection(array(), $path, $options);
116+
$result = $connection->call('Webshop.get', array(22222, 'uid'));
117+
$this->assertEquals(22222, $result['uid']);
118+
}
119+
120+
public function testWsCallWithHeaders() {
121+
$path = 'ws://shop.textalk.se/backend/jsonrpc/v1';
122+
$options = array('headers' => array('foo' => 'bar', 'boo' => 'far'));
123+
$connection = new Connection(array(), $path, $options);
124+
$result = $connection->call('Webshop.get', array(22222, 'uid'));
125+
$this->assertEquals(22222, $result['uid']);
126+
}
127+
128+
public function testWssCallWithHeaders() {
129+
$path = 'wss://shop.textalk.se/backend/jsonrpc/v1';
130+
$options = array('headers' => array('foo' => 'bar', 'boo' => 'far'));
131+
$connection = new Connection(array(), $path, $options);
132+
$result = $connection->call('Webshop.get', array(22222, 'uid'));
133+
$this->assertEquals(22222, $result['uid']);
134+
}
135+
104136
/**
105137
* @expectedException RuntimeException
106138
*/

0 commit comments

Comments
 (0)