File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public function parse($payload)
3131 }
3232 return array ();
3333 } else {
34- throw new ParserException ('Failed To Parse BSON - Supporting Library Not Available. ' );
34+ throw new ParserException ('Failed To Parse BSON - Supporting Library Not Available ' );
3535 }
3636 }
3737
Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ public function parser_empty_json_data()
260260 /** @test */
261261 public function parser_validates_bson_data ()
262262 {
263- if (function_exists ('bson_encode ' )) {
263+ if (function_exists ('bson_decode ' )) {
264264 $ expected = array ('status ' => 123 , 'message ' => 'hello world ' );
265265 $ payload = bson_encode ($ expected );
266266
@@ -272,8 +272,21 @@ public function parser_validates_bson_data()
272272 /** @test */
273273 public function parser_empty_bson_data ()
274274 {
275- $ parser = new Parser ();
276- $ this ->assertEquals (array (), $ parser ->bson ("" ));
275+ if (function_exists ('bson_decode ' )) {
276+ $ parser = new Parser ();
277+ $ this ->assertEquals (array (), $ parser ->bson ("" ));
278+ }
279+ }
280+
281+ /** @test */
282+ public function throw_an_exception_when_bson_library_not_loaded ()
283+ {
284+ if (! function_exists ('bson_decode ' )) {
285+ $ this ->setExpectedException ('Exception ' , 'Failed To Parse BSON - Supporting Library Not Available ' );
286+
287+ $ parser = new Parser ();
288+ $ this ->assertEquals (array (), $ parser ->bson ("" ));
289+ }
277290 }
278291
279292 /** @test */
You can’t perform that action at this time.
0 commit comments