@@ 85-100 (lines=16) @@ | ||
82 | $controller->jsonRpcAction($request); |
|
83 | } |
|
84 | ||
85 | public function testSingleRequestHandling() |
|
86 | { |
|
87 | $controller = $this->createController(); |
|
88 | $request = $this->createJsonRequest( |
|
89 | '/', |
|
90 | [ |
|
91 | 'jsonrpc' => '2.0', |
|
92 | 'id' => 'test', |
|
93 | 'method' => 'test', |
|
94 | ] |
|
95 | ); |
|
96 | $response = $controller->jsonRpcAction($request); |
|
97 | ||
98 | self::assertTrue($response->isSuccessful()); |
|
99 | self::assertEquals('{"jsonrpc":"2.0","id":"test","result":{"success":true}}', $response->getContent()); |
|
100 | } |
|
101 | ||
102 | public function testBatchRequestHandling() |
|
103 | { |
|
@@ 102-119 (lines=18) @@ | ||
99 | self::assertEquals('{"jsonrpc":"2.0","id":"test","result":{"success":true}}', $response->getContent()); |
|
100 | } |
|
101 | ||
102 | public function testBatchRequestHandling() |
|
103 | { |
|
104 | $controller = $this->createController(); |
|
105 | $request = $this->createJsonRequest( |
|
106 | '/', |
|
107 | [ |
|
108 | [ |
|
109 | 'jsonrpc' => '2.0', |
|
110 | 'id' => 'test', |
|
111 | 'method' => 'test', |
|
112 | ], |
|
113 | ] |
|
114 | ); |
|
115 | $response = $controller->jsonRpcAction($request); |
|
116 | ||
117 | self::assertTrue($response->isSuccessful()); |
|
118 | self::assertEquals('[{"jsonrpc":"2.0","id":"test","result":{"success":true}}]', $response->getContent()); |
|
119 | } |
|
120 | ||
121 | public function testExceptionHandling() |
|
122 | { |
|
@@ 121-139 (lines=19) @@ | ||
118 | self::assertEquals('[{"jsonrpc":"2.0","id":"test","result":{"success":true}}]', $response->getContent()); |
|
119 | } |
|
120 | ||
121 | public function testExceptionHandling() |
|
122 | { |
|
123 | $controller = $this->createController(); |
|
124 | $request = $this->createJsonRequest( |
|
125 | '/', |
|
126 | [ |
|
127 | 'jsonrpc' => '2.0', |
|
128 | 'id' => 'test', |
|
129 | 'method' => 'exception', |
|
130 | ] |
|
131 | ); |
|
132 | $response = $controller->jsonRpcAction($request); |
|
133 | ||
134 | self::assertTrue($response->isSuccessful()); |
|
135 | self::assertEquals( |
|
136 | '{"jsonrpc":"2.0","id":"test","error":{"code":-32603,"message":"Failure!","data":null}}', |
|
137 | $response->getContent() |
|
138 | ); |
|
139 | } |
|
140 | ||
141 | public function testExceptionHandlingAmongBatchRequest() |
|
142 | { |