Esempio n. 1
0
 public function testGetJSONNotify()
 {
     $request = new Junior\Clientside\Request($this->method, $this->params, true);
     $this->assertEquals(json_encode(array('jsonrpc' => Junior\Clientside\Request::JSON_RPC_VERSION, 'method' => $this->method, 'params' => array($this->params))), $request->getJSON());
 }
Esempio n. 2
0
 public function testNonExistentMethod()
 {
     $request = new Junior\Clientside\Request('doesNotExist', null);
     $expectedRegex = '/{"jsonrpc":"2.0","method":"doesNotExist","id":"[^"]+"}/';
     $this->assertRegExp($expectedRegex, $request->getJSON());
     $this->assertRegExp($expectedRegex, $this->client->sendRequest($request));
     $sentJSON = '{"jsonrpc":"2.0","method":"doesNotExist","id":"1"}';
     $returnJSON = '{"jsonrpc":"2.0","error":{"code":-32601,"message":"Method not found."},"id":"1"}';
     $this->setRequest($sentJSON);
     $this->server->process();
     $this->expectOutputString($returnJSON);
 }