File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public function serialize($data): string
1818 throw new CantBeSerialized ('Resources can not be serialized to json ' );
1919 }
2020
21- return json_encode ($ data , JSON_PRETTY_PRINT )."\n" ;
21+ return json_encode ($ data , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE )."\n" ;
2222 }
2323
2424 public function extension (): string
Original file line number Diff line number Diff line change @@ -18,12 +18,12 @@ public function it_can_serialize_a_json_string_to_pretty_json()
1818
1919 $ expected = implode ("\n" , [
2020 '{ ' ,
21- ' "foo": "bar" ' ,
21+ ' "foo": "bar/baz 😊 " ' ,
2222 '} ' ,
2323 '' ,
2424 ]);
2525
26- $ this ->assertEquals ($ expected , $ driver ->serialize ('{"foo":"bar"} ' ));
26+ $ this ->assertEquals ($ expected , $ driver ->serialize ('{"foo":"bar\/baz \ud83d\ude0a "} ' ));
2727 }
2828
2929 #[Test]
@@ -135,6 +135,7 @@ public function it_can_not_serialize_resources()
135135 #[TestWith(['1 ' , '1 ' , true ])]
136136 #[TestWith(['1.1 ' , '1.1 ' , true ])]
137137 #[TestWith(['{"empty": []} ' , '{"empty":{}} ' , false ])]
138+ #[TestWith(['{"url": "foo\/bar😊"} ' , '{"url":"foo/bar\ud83d\ude0a"} ' , true ])]
138139 public function it_can_match_json_strings (string $ expected , string $ actual , bool $ assertion )
139140 {
140141 $ driver = new JsonDriver ;
You can’t perform that action at this time.
0 commit comments