unwrapAll() public method

public unwrapAll ( array $arguments ) : array
$arguments array
return array
コード例 #1
0
ファイル: WrappedObject.php プロジェクト: mawaha/tracker
 /**
  * @param string $classname
  * @param array  $arguments
  *
  * @throws \PhpSpec\Exception\Wrapper\SubjectException
  */
 public function beAnInstanceOf($classname, array $arguments = array())
 {
     if (!is_string($classname)) {
         throw new SubjectException(sprintf('Behavior subject classname should be a string, %s given.', $this->presenter->presentValue($classname)));
     }
     $this->classname = $classname;
     $unwrapper = new Unwrapper();
     $this->arguments = $unwrapper->unwrapAll($arguments);
     $this->isInstantiated = false;
 }
コード例 #2
0
ファイル: VarienCaller.php プロジェクト: kbulloch/MageSpec_vm
 /**
  * @param string $method
  * @param array  $arguments
  *
  * @return Subject
  *
  * @throws \PhpSpec\Exception\Fracture\MethodNotFoundException
  * @throws \PhpSpec\Exception\Fracture\MethodNotVisibleException
  * @throws \PhpSpec\Exception\Wrapper\SubjectException
  */
 public function call($method, array $arguments = array())
 {
     if (null === $this->getWrappedObject()) {
         throw $this->callingMethodOnNonObject($method);
     }
     $subject = $this->wrappedObject->getInstance();
     $unwrapper = new Unwrapper();
     $arguments = $unwrapper->unwrapAll($arguments);
     if ($this->isObjectMethodAccessible($method)) {
         return $this->invokeAndWrapMethodResult($subject, $method, $arguments);
     }
     throw $this->methodNotFound($method, $arguments);
 }
コード例 #3
0
 /**
  * @param string $name
  * @param mixed  $subject
  * @param array  $arguments
  *
  * @return Matcher
  */
 private function findMatcher($name, $subject, array $arguments = array())
 {
     $unwrapper = new Unwrapper();
     $arguments = $unwrapper->unwrapAll($arguments);
     return $this->matchers->find($name, $subject, $arguments);
 }
コード例 #4
0
 /**
  *
  * @param string $alias        	
  * @param mixed $subject        	
  * @param array $arguments        	
  *
  * @return mixed
  */
 public function match($alias, $subject, array $arguments = array())
 {
     $arguments = $this->unwrapper->unwrapAll($arguments);
     return $this->getExpectation()->match($alias, $subject, $arguments);
 }
コード例 #5
0
 /**
  * @param callable|string|null $factoryMethod
  * @param array                $arguments
  */
 public function beConstructedThrough($factoryMethod, array $arguments = array())
 {
     if (is_string($factoryMethod) && false === strpos($factoryMethod, '::') && method_exists($this->classname, $factoryMethod)) {
         $factoryMethod = array($this->classname, $factoryMethod);
     }
     if ($this->isInstantiated()) {
         throw new SubjectException('You can not change object construction method when it is already instantiated');
     }
     $this->factoryMethod = $factoryMethod;
     $unwrapper = new Unwrapper();
     $this->arguments = $unwrapper->unwrapAll($arguments);
 }
コード例 #6
0
ファイル: ThrowMatcherSpec.php プロジェクト: phpspec/phpspec
 function let(Unwrapper $unwrapper, Presenter $presenter, ReflectionFactory $factory)
 {
     $unwrapper->unwrapAll(Argument::any())->willReturnArgument();
     $presenter->presentValue(Argument::any())->willReturn('val1', 'val2');
     $this->beConstructedWith($unwrapper, $presenter, $factory);
 }
コード例 #7
0
 function let(Unwrapper $unwrapper)
 {
     $unwrapper->unwrapAll(Argument::any())->willReturnArgument();
     $this->beConstructedWith($unwrapper);
 }