-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PropertyAccess] array_keys does not work for ArrayAccess objects #10705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
namespace Symfony\Component\PropertyAccess\Tests; | ||
|
||
use Symfony\Component\PropertyAccess\PropertyAccessor; | ||
use Symfony\Component\PropertyAccess\Tests\Fixtures\CustomArrayObject; | ||
|
||
class PropertyAccessorCustomArrayObjectTest extends PropertyAccessorCollectionTest | ||
|
@@ -19,4 +20,15 @@ protected function getCollection(array $array) | |
{ | ||
return new CustomArrayObject($array); | ||
} | ||
|
||
/** | ||
* @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchIndexException | ||
*/ | ||
public function testGetNoSuchIndex() | ||
{ | ||
$arrayObject = new CustomArrayObject(array('foo', 'bar')); | ||
$propertyAccessor = new PropertyAccessor(false, true); | ||
|
||
$propertyAccessor->getValue($arrayObject, '[2]'); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also add a test for a Travesable object? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having a test for |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use implode() with
", "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code also used print_r() so I left it that way.