function it_proxies_method_calls_to_wrapped_object(\ArrayObject $obj, WrappedObject $wrappedObject, AccessInspectorInterface $accessInspector)
 {
     $obj->asort()->shouldBeCalled();
     $wrappedObject->isInstantiated()->willReturn(true);
     $wrappedObject->getInstance()->willReturn($obj);
     $accessInspector->isMethodCallable(Argument::type('ArrayObject'), 'asort')->willReturn(true);
     $this->call('asort');
 }
Exemple #2
0
 /**
  *
  * @param string $method        	
  *
  * @return bool
  */
 private function isObjectMethodCallable($method)
 {
     return $this->accessInspector->isMethodCallable($this->getWrappedObject(), $method);
 }
 /**
  * @param object $object
  * @param string $method
  *
  * @return bool
  */
 public function isMethodCallable($object, $method)
 {
     return method_exists($object, '__call') || $this->accessInspector->isMethodCallable($object, $method);
 }
 function it_should_detect_a_method_if_there_is_no_magic_caller_but_wrapped_inspector_finds_one(AccessInspectorInterface $accessInspector)
 {
     $accessInspector->isMethodCallable(new \StdClass(), 'foo')->willReturn(true);
     $this->isMethodCallable(new \StdClass(), 'foo')->shouldReturn(true);
 }
Exemple #5
0
 /**
  * @param string $property
  *
  * @return bool
  */
 private function isObjectPropertyReadable($property)
 {
     $subject = $this->getWrappedObject();
     return is_object($subject) && $this->accessInspector->isPropertyReadable($subject, $property);
 }