function it_sets_a_property_on_the_wrapped_object(WrappedObject $wrappedObject, AccessInspector $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); }
/** * @param string $property * * @return bool */ private function isObjectPropertyWritable($property) { $subject = $this->getWrappedObject(); return is_object($subject) && $this->accessInspector->isPropertyWritable($subject, $property); }
function it_should_detect_a_setter_if_there_is_no_magic_setter_but_wrapped_inspector_finds_one(AccessInspector $accessInspector) { $accessInspector->isPropertyWritable(new \StdClass(), 'foo')->willReturn(true); $this->isPropertyWritable(new \StdClass(), 'foo')->shouldReturn(true); }