Skip to content

Commit

Permalink
Tests with header options.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sören committed Jul 11, 2016
1 parent 9b3fd39 commit ead4bd3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit ead4bd3

Please sign in to comment.