function it_sets_a_property_on_the_wrapped_object(WrappedObject $wrappedObject, AccessInspectorInterface $accessInspector)
 {
     $obj = new \stdClass();
     $obj->id = 1;
     $accessInspector->isPropertyWritable(Argument::type('stdClass'), 'id')->willReturn('true');
     $wrappedObject->isInstantiated()->willReturn(true);
     $wrappedObject->getInstance()->willReturn($obj);
     $this->set('id', 2)->shouldReturn(2);
 }
 function it_should_detect_a_setter_if_there_is_no_magic_setter_but_wrapped_inspector_finds_one(AccessInspectorInterface $accessInspector)
 {
     $accessInspector->isPropertyWritable(new \StdClass(), 'foo')->willReturn(true);
     $this->isPropertyWritable(new \StdClass(), 'foo')->shouldReturn(true);
 }
Exemple #3
0
 /**
  *
  * @param string $property        	
  *
  * @return bool
  */
 private function isObjectPropertyWritable($property)
 {
     $subject = $this->getWrappedObject();
     return is_object($subject) && $this->accessInspector->isPropertyWritable($subject, $property);
 }
 /**
  * @param object $object
  * @param string $property
  *
  * @return bool
  */
 public function isPropertyWritable($object, $property)
 {
     return method_exists($object, '__set') || $this->accessInspector->isPropertyWritable($object, $property);
 }