Exemple #1
0
 public function testPrepareRequest()
 {
     $client = new Client('http://localhost/');
     $payload = $client->prepareRequest('myProcedure');
     $this->assertNotEmpty($payload);
     $this->assertArrayHasKey('jsonrpc', $payload);
     $this->assertEquals('2.0', $payload['jsonrpc']);
     $this->assertArrayHasKey('method', $payload);
     $this->assertEquals('myProcedure', $payload['method']);
     $this->assertArrayHasKey('id', $payload);
     $this->assertArrayNotHasKey('params', $payload);
     $payload = $client->prepareRequest('myProcedure', array('p1' => 3));
     $this->assertNotEmpty($payload);
     $this->assertArrayHasKey('jsonrpc', $payload);
     $this->assertEquals('2.0', $payload['jsonrpc']);
     $this->assertArrayHasKey('method', $payload);
     $this->assertEquals('myProcedure', $payload['method']);
     $this->assertArrayHasKey('id', $payload);
     $this->assertArrayHasKey('params', $payload);
     $this->assertEquals(array('p1' => 3), $payload['params']);
 }