- updating tests

This commit is contained in:
Reza
2015-10-19 10:16:11 +03:30
parent e319caa9b6
commit 1654af229e
2 changed files with 15 additions and 3 deletions

View File

@ -10,7 +10,14 @@
namespace Salarmehr;
class Ary implements \ArrayAccess, \Countable, \IteratorAggregate, \JsonSerializable
use ArrayAccess;
use ArrayIterator;
use CachingIterator;
use Countable;
use IteratorAggregate;
use JsonSerializable;
class Ary implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable
{
/**
@ -75,7 +82,6 @@ class Ary implements \ArrayAccess, \Countable, \IteratorAggregate, \JsonSerializ
public function __set($name, $value)
{
$this->items['name'] = $value;
$this->offsetSet($name, $value);
}
@ -172,7 +178,7 @@ class Ary implements \ArrayAccess, \Countable, \IteratorAggregate, \JsonSerializ
*/
public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING)
{
return new CachingIterator($this->getIterator(), $flags);
return new \CachingIterator($this->getIterator(), $flags);
}
/**

View File

@ -105,7 +105,13 @@ class Test extends PHPUnit_Framework_TestCase
// var_dump($ary);die();
$ary[] = 3;
$this->assertEquals($ary[0], 3);
$this->assertEquals($ary->{0}, 3);
$this->assertTrue($ary->has(0));
$ary['x'] = ['z' => 'y'];
$ary['foo'] = 'bar';
$this->assertEquals($ary['foo'], 'bar');
$this->assertEquals($ary->foo, 'bar');
$this->assertTrue($ary->has('foo'));
$this->assertEquals($ary['x']['z'], 'y');
$ary['x']['z'] = 'm';
$this->assertEquals($ary['x']['z'], 'm');