Added more tests for PropertyAccess
This commit is contained in:
parent
380e2ba103
commit
378db759e0
@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\PropertyAccess\Tests;
|
||||
|
||||
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
|
||||
use Symfony\Component\PropertyAccess\PropertyAccessor;
|
||||
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClass;
|
||||
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicCall;
|
||||
@ -139,6 +140,20 @@ class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertSame(array('Bernhard'), $object->firstName);
|
||||
}
|
||||
|
||||
public function testGetValueNotModifyObjectException()
|
||||
{
|
||||
$propertyAccessor = new PropertyAccessor(false, true);
|
||||
$object = new \stdClass();
|
||||
$object->firstName = array('Bernhard');
|
||||
|
||||
try {
|
||||
$propertyAccessor->getValue($object, 'firstName[1]');
|
||||
} catch (NoSuchIndexException $e) {
|
||||
}
|
||||
|
||||
$this->assertSame(array('Bernhard'), $object->firstName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
|
||||
*/
|
||||
|
Reference in New Issue
Block a user