From 5ebf8b450edebec80c4f4d81ed2f7d1394c65135 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 22 Nov 2009 15:56:00 -0500 Subject: [PATCH] finish parse json --- classes/PostFixtures.inc | 2 +- test/PostFixturesTest.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/PostFixtures.inc b/classes/PostFixtures.inc index 4f980d5..a706b55 100644 --- a/classes/PostFixtures.inc +++ b/classes/PostFixtures.inc @@ -4,7 +4,7 @@ class PostFixtures { function parse_json($input) { if (($data = json_decode($input)) !== false) { if (is_array($data) || is_object($data)) { - return (array)$data; + return array_values((array)$data); } } return false; diff --git a/test/PostFixturesTest.php b/test/PostFixturesTest.php index b03f1c3..9b90d6f 100644 --- a/test/PostFixturesTest.php +++ b/test/PostFixturesTest.php @@ -17,7 +17,9 @@ class PostFixturesTest extends PHPUnit_Framework_TestCase { array('', false), array('{]', false), array('{}', array()), - array('[]', array()) + array('[]', array()), + array('["test", "test2"]', array('test', 'test2')), + array('{"one": "test", "two": "test2"}', array('test', 'test2')) ); }