From 1aca4598a8007b19436a384c25a6ca801f63bfd5 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 22 Nov 2009 15:50:16 -0500 Subject: [PATCH] parse json --- classes/PostFixtures.inc | 11 +++++++++++ test/PostFixturesTest.php | 29 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/classes/PostFixtures.inc b/classes/PostFixtures.inc index b3d9bbc..4f980d5 100644 --- a/classes/PostFixtures.inc +++ b/classes/PostFixtures.inc @@ -1 +1,12 @@ pf = new PostFixtures(); + } + + function providerTestParseJSON() { + return array( + array(false, false), + array('', false), + array('{]', false), + array('{}', array()), + array('[]', array()) + ); + } + + /** + * @dataProvider providerTestParseJSON + */ + function testParseJSON($input, $expected_output) { + $this->assertEquals($expected_output, $this->pf->parse_json($input)); + } +}