8000 [PropertyAccess] stop overwriting once a reference is reached (3rd) by bananer · Pull Request #13835 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[PropertyAccess] stop overwriting once a reference is reached (3rd) #13835

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[PropertyAccess] Add test cases for nested objects and arrays
  • Loading branch information
bananer committed Mar 3, 2015
commit 42ad722406ce1e7a7690b5f959a366cf53f0423e
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ private function hasPrivateHasAccessor()
return 'foobar';
}

public function getPublicGetter() {
public function getPublicGetter()
{
return $this->publicGetter;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,14 @@ public function getValidPropertyPaths()
array(array('index' => array('%!@$§.' => 'Bernhard')), '[index][%!@$§.]', 'Bernhard'),
array((object) array('%!@$§' => 'Bernhard'), '%!@$§', 'Bernhard'),
array((object) array('property' => (object) array('%!@$§' => 'Bernhard')), 'property.%!@$§', 'Bernhard'),

// nested objects and arrays
array(array('foo' => new TestClass('bar')), '[foo].publicGetSetter', 'bar'),
array(new TestClass(array('foo' => 'bar')), 'publicGetSetter[foo]', 'bar'),
array(new TestClass(new TestClass('bar')), 'publicGetter.publicGetSetter', 'bar'),
array(new TestClass(array('foo' => new TestClass('bar'))), 'publicGetter[foo].publicGetSetter', 'bar'),
array(new TestClass(new TestClass(new TestClass('bar'))), 'publicGetter.publicGetter.publicGetSetter', 'bar'),
array(new TestClass(array('foo' => array('baz' => new TestClass('bar')))), 'publicGetter[foo][baz].publicGetSetter', 'bar'),
);
}

Expand All @@ -430,12 +438,4 @@ public function testTicket5755()

$this->assertEquals('foobar', $object->getProperty());
}

public function testPublicGetter()
{
$this->propertyAccessor = new PropertyAccessor(true);

$this->assertTrue($this->propertyAccessor->isReadable(new TestClass('foo'), 'publicGetter'));
$this->assertEquals('foo', $this->propertyAccessor->getValue(new TestClass('foo'), 'publicGetter'));
}
}
0