コード例 #1
0
    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)));
    }
コード例 #2
0
 /**
  * @dataProvider dataPrettify
  */
 public function testPrettifyIsJsonOverride($object, $expected, $is_json)
 {
     $jsonPretty = new JsonPretty();
     $this->assertEquals($expected, $jsonPretty->prettify($object, null, "\t", $is_json));
 }
コード例 #3
0
 /**
  * @dataProvider dataPrettify
  */
 public function testPrettify($object, $expected)
 {
     $jsonPretty = new JsonPretty();
     $this->assertEquals($expected, $jsonPretty->prettify($object));
     $this->assertEquals($expected, $jsonPretty->prettify(json_encode($object)));
 }