- updating jsonSerialize

This commit is contained in:
Reza
2015-11-06 09:11:36 +03:30
parent e912a1c33c
commit 3aa13cff4b
2 changed files with 10 additions and 1 deletions

View File

@ -146,7 +146,7 @@ class Ary implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable
*/
public function jsonSerialize()
{
return $this->jsonSerialize();
return $this->all();
}
/**

View File

@ -47,6 +47,7 @@ class Test extends PHPUnit_Framework_TestCase
{
return array(
array('', ''),
array(null, null),
array(['ali', 'reza', 'mohammad'], ['ali', 'reza', 'mohammad']),
array(['name' => 'ali', 'lastname' => 'reza', 'age' => 30], ['name' => 'ali', 'lastname' => 'reza', 'age' => 30]),
array((object)['name' => 'ali', 'lastname' => 'reza', 'age' => 30], (object)['name' => 'ali', 'lastname' => 'reza', 'age' => 30]),
@ -118,6 +119,14 @@ class Test extends PHPUnit_Framework_TestCase
}
/**
* @dataProvider various
*/
public function testJsonSerialize($original, $expected)
{
$this->assertEquals(json_encode(new Ary($original)), json_encode((array)$original));
}
// public function testOffsetExists()
// {
// $parameters = array(7,8,9,4);