@@ -69,12 +69,64 @@ public function it_returns_false_with_non_json_string_and_second_argument_passed
69
69
}
70
70
71
71
/** @test */
72
- public function it_returns_true_with_json_string_passed ()
72
+ public function it_returns_true_with_json_encoded_null_passed ()
73
+ {
74
+ $ json = json_encode (null );
75
+ $ this ->assertTrue (is_json ($ json ));
76
+ }
77
+
78
+ /** @test */
79
+ public function it_returns_true_with_json_encoded_boolean_true_passed ()
80
+ {
81
+ $ json = json_encode (true );
82
+ $ this ->assertTrue (is_json ($ json ));
83
+ }
84
+
85
+ /** @test */
86
+ public function it_returns_true_with_json_encoded_boolean_false_passed ()
87
+ {
88
+ $ json = json_encode (false );
89
+ $ this ->assertTrue (is_json ($ json ));
90
+ }
91
+
92
+ /** @test */
93
+ public function it_returns_true_with_json_encoded_integer_passed ()
94
+ {
95
+ $ json = json_encode (123 );
96
+ $ this ->assertTrue (is_json ($ json ));
97
+ }
98
+
99
+ /** @test */
100
+ public function it_returns_true_with_json_encoded_float_passed ()
101
+ {
102
+ $ json = json_encode (123.45 );
103
+ $ this ->assertTrue (is_json ($ json ));
104
+ }
105
+
106
+ /** @test */
107
+ public function it_returns_true_with_json_encoded_array_passed ()
73
108
{
74
109
$ json = json_encode (['foo ' => 'bar ' ]);
75
110
$ this ->assertTrue (is_json ($ json ));
76
111
}
77
112
113
+ /** @test */
114
+ public function it_returns_true_with_json_encoded_object_passed ()
115
+ {
116
+ $ object = new StdClass ();
117
+ $ object ->foo = 'bar ' ;
118
+ $ object ->baz = 'bax ' ;
119
+ $ json = json_encode ($ object );
120
+ $ this ->assertTrue (is_json ($ json ));
121
+ }
122
+
123
+ /** @test */
124
+ public function it_returns_true_with_json_encoded_string_passed ()
125
+ {
126
+ $ json = json_encode ('string to encode ' );
127
+ $ this ->assertTrue (is_json ($ json ));
128
+ }
129
+
78
130
/** @test */
79
131
public function it_returns_decoded_json_with_second_argument_passed ()
80
132
{
0 commit comments