minor #16155 Added more tests for PropertyAccess (pierredup)
This PR was merged into the 2.7 branch.
Discussion
----------
Added more tests for PropertyAccess
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
This is a follow up for [16090#issuecomment-145183635](https://github.com/symfony/symfony/pull/16090#issuecomment-145183635)
Commits
-------
378db75
Added more tests for PropertyAccess
This commit is contained in:
commit
a954fea00e
@ -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