$this->propertyAccessor->
setValue($object, 'date',
$date);
$this->
assertSame($date,
$object->
getDate());
} public function testArrayNotBeeingOverwritten() { $value =
['value1' => 'foo', 'value2' => 'bar'
];
$object =
new TestClass($value);
$this->propertyAccessor->
setValue($object, 'publicAccessor[value2]', 'baz'
);
$this->
assertSame('baz',
$this->propertyAccessor->
getValue($object, 'publicAccessor[value2]'
));
$this->
assertSame(['value1' => 'foo', 'value2' => 'baz'
],
$object->
getPublicAccessor());
} public function testCacheReadAccess() { $obj =
new TestClass('foo'
);
$propertyAccessor =
new PropertyAccessor(PropertyAccessor::DISALLOW_MAGIC_METHODS, PropertyAccessor::THROW_ON_INVALID_PROPERTY_PATH,
new ArrayAdapter());
$this->
assertEquals('foo',
$propertyAccessor->
getValue($obj, 'publicGetSetter'
));
$propertyAccessor->
setValue($obj, 'publicGetSetter', 'bar'
);
$propertyAccessor->
setValue($obj, 'publicGetSetter', 'baz'
);
$this->
assertEquals('baz',
$propertyAccessor->
getValue($obj, 'publicGetSetter'
));
}