コード例 #1
0
ファイル: RequestTest.php プロジェクト: fritz-payment/jsonrpc
 public function testNotNotificationWithNullIdThrowsException()
 {
     $request = new Request();
     $request->setMethod('test')->setIsNotification(false)->setId(null);
     $request->setStrictMode(true);
     try {
         $request->getRequestBody();
     } catch (RequestException $e) {
         $this->assertContains('NULL id', $e->getMessage());
         return;
     }
     $this->fail('Expecting exception.');
 }
コード例 #2
0
 public function provideErrorResponses()
 {
     $res = array();
     $req = new Request();
     $req->setId('1');
     $res[] = array($req, '{"result":null,"error":{"code":1,"message":"err"},"id":"1"}', '{"code":1,"message":"err"}');
     $res[] = array($req, '{"result":null,"error":{"code":2,"message":"err2","data":{"test":"test"}},"id":"1"}', '{"code":2,"message":"err2","data":{"test":"test"}}');
     return $res;
 }