public function testNotNotificationWithNullIdThrowsException() { $request = new Request(); $request->setMethod('test')->setIsNotification(false)->setId(null); try { $request->getRequestBody(); } catch (RequestException $e) { $this->assertContains('NULL id', $e->getMessage()); return; } $this->fail('Expecting exception.'); }
public function provideErrorResponses() { $res = array(); $req = new Request(); $req->setId('1'); $res[] = array($req, '{"result":null,"error":["a"],"id":"1"}', '["a"]'); $res[] = array($req, '{"result":null,"error":"b","id":"1"}', 'b'); $res[] = array($req, '{"result":null,"error":{"a":"b"},"id":"1"}', '{"a":"b"}'); return $res; }