private function compare(Client $client, $expectedJsonOutput)
 {
     $actualJsonOutput = $client->encode();
     $expectedOutput = @json_decode($expectedJsonOutput, true);
     $actualOutput = @json_decode($actualJsonOutput, true);
     $this->assertEquals($expectedOutput, $actualOutput);
 }
Beispiel #2
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Datto\JsonRpc\Client;
$client = new Client();
$client->query(1, 'Math/subtract', array(5, 3));
$request = $client->encode();
echo $request, "\n";
// {"jsonrpc":"2.0","id":1,"method":"Math\/subtract","params":[5,3]}
 public function send()
 {
     $content = $this->client->encode();
     $reply = $this->execute(self::$METHOD, $this->headers, $content);
     return $this->client->decode($reply);
 }
Beispiel #4
0
<?php

use Datto\JsonRpc\Client;
require_once __DIR__ . '/../vendor/autoload.php';
$client = new Client();
$client->query(1, 'add', array(1, 2));
$message = $client->encode();
echo $message, "\n";
// {"jsonrpc":"2.0","id":1,"method":"add","params":[1,2]}