function it_should_detect_a_getter_if_there_is_no_magic_getter_but_wrapped_inspector_finds_one(AccessInspectorInterface $accessInspector) { $accessInspector->isPropertyReadable(new \StdClass(), 'foo')->willReturn(true); $this->isPropertyReadable(new \StdClass(), 'foo')->shouldReturn(true); }
/** * * @param string $property * * @return bool */ private function isObjectPropertyReadable($property) { $subject = $this->getWrappedObject(); return is_object($subject) && $this->accessInspector->isPropertyReadable($subject, $property); }
/** * @param object $object * @param string $property * * @return bool */ public function isPropertyReadable($object, $property) { return method_exists($object, '__get') || $this->accessInspector->isPropertyReadable($object, $property); }