public function testPrettify() { $object = array('test' => 'test', 'object' => array('hello' => 'hello')); $expected = <<<JSON { \t"test": "test", \t"object": { \t\t"hello": "hello" \t} } JSON; $jsonPretty = new JsonPretty(); $this->assertEquals($expected, $jsonPretty->prettify($object)); $this->assertEquals($expected, $jsonPretty->prettify(json_encode($object))); }
/** * @dataProvider dataPrettify */ public function testPrettifyIsJsonOverride($object, $expected, $is_json) { $jsonPretty = new JsonPretty(); $this->assertEquals($expected, $jsonPretty->prettify($object, null, "\t", $is_json)); }
/** * @dataProvider dataPrettify */ public function testPrettify($object, $expected) { $jsonPretty = new JsonPretty(); $this->assertEquals($expected, $jsonPretty->prettify($object)); $this->assertEquals($expected, $jsonPretty->prettify(json_encode($object))); }