- updating jsonSerialize
This commit is contained in:
@ -146,7 +146,7 @@ class Ary implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->jsonSerialize();
|
||||
return $this->all();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user