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.'); }
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; }