public function provideResponses() { $res = array(); $req = new Request(); $req->setId('1'); $res[] = array($req, '{"result":["a"],"error":null,"id":"1"}', array('a')); $res[] = array($req, '{"result":"b","error":null,"id":"1"}', 'b'); $req = new Request(); $req->setIsNotification(true); $res[] = array($req, '', null); return $res; }
public function testRequestHasCorrectDefaultValues() { $request = new Request(); $this->assertFalse($request->isNotification()); $this->assertNull($request->getMethod()); $request->setMethod('test'); $request->setId('1'); $this->assertFalse($request->isNotification()); // explicitly set notification type, but id present // implies: no notification $request->setIsNotification(true); $this->assertFalse($request->isNotification()); $expect = '{"jsonrpc":"2.0","method":"test","id":"1"}'; $this->assertEquals($expect, $request->getRequestBody()); }