@@ -66,6 +66,17 @@ public function testEncodeJSONArray(){
66
66
$ this ->assertEquals ('[] ' ,Message::encodeJSON ([]));
67
67
}
68
68
69
+ /**
70
+ * @return void
71
+ * @throws JSONRPCException
72
+ */
73
+ public function testEncodeJSONResource (){
74
+ $ this ->expectException (JSONRPCException::class);
75
+ $ this ->expectExceptionMessage ('Failed to encode JSON. ' );
76
+
77
+ Message::encodeJSON (tmpfile ());
78
+ }
79
+
69
80
public function testIsBatch (){
70
81
$ this ->assertTrue (Message::isBatch ([]));
71
82
@@ -161,7 +172,7 @@ public function testParseEmptyObject(){
161
172
*/
162
173
public function testParseRequestV1WithMethod (){
163
174
$ this ->expectException (JSONRPCException::class);
164
- $ this ->expectExceptionMessage ('[V1] The "method" property in request MUST be a string. ' );
175
+ $ this ->expectExceptionMessage ('The "method" property in request MUST be a string. ' );
165
176
166
177
Message::parseObject ((object ) ['method ' =>null ]);
167
178
}
@@ -183,7 +194,7 @@ public function testParseRequestV1WithMethodString(){
183
194
*/
184
195
public function testParseRequestV1WithParams (){
185
196
$ this ->expectException (JSONRPCException::class);
186
- $ this ->expectExceptionMessage ('[V1] Missing "method" property in request. ' );
197
+ $ this ->expectExceptionMessage ('Missing "method" property in request. ' );
187
198
188
199
Message::parseObject ((object ) ['params ' =>null ]);
189
200
}
@@ -383,6 +394,10 @@ public function testCreateResponseMessageV1WithErrorFalse(){
383
394
Message::createResponseMessageV1 (123 ,null ,false );
384
395
}
385
396
397
+ public function testToObject (){
398
+ $ this ->assertEquals ((object ) ['id ' =>123 ,'method ' =>'getMethod ' ,'params ' =>['param1 ' ,'param2 ' ]],Message::createRequestMessageV1 (123 ,'getMethod ' ,['param1 ' ,'param2 ' ])->toObject ());
399
+ }
400
+
386
401
// /**
387
402
// * @return void
388
403
// * @throws JSONRPCException
0 commit comments