Mockery\Expectation::withArgs PHP Method

withArgs() public method

Expected arguments for the expectation passed as an array or a closure that matches each passed argument on each function call.
public withArgs ( array | Closur\Closure $argsOrClosure ) : self
$argsOrClosure array | Closur\Closure
return self
    public function withArgs($argsOrClosure)
    {
        if (is_array($argsOrClosure)) {
            $this->withArgsInArray($argsOrClosure);
        } elseif ($argsOrClosure instanceof Closure) {
            $this->withArgsMatchedByClosure($argsOrClosure);
        } else {
            throw new \InvalidArgumentException(sprintf('Call to %s with an invalid argument (%s), only array and ' . 'closure are allowed', __METHOD__, $argsOrClosure));
        }
        return $this;
    }

Usage Example

 /**
  * @return $this
  */
 public function withArgs(array $args)
 {
     $this->expectation->withArgs($args);
     return $this;
 }