lithium\test\MockerChain::with()

public method

Will further narrow down the original 'called' method.

Valides the cached method name was called with these args

Parameters

  • mixed $arg,...

    Optional arguments to test against

Returns

object

Source

	public function with() {
		if (!$this->_data['success']) {
			return $this;
		}

		$method = $this->_data['method'];
		$this->_data['args'] = $args = func_get_args();

		foreach ($this->_data['results'][$method] as $call) {
			$correctTime = $this->_data['callTime'] <= $call['time'];
			$correctArgs = $args === $call['args'];
			if ($correctTime && $correctArgs) {
				$this->_data['callTime'] = $call['time'];
				return $this;
			}
		}

		$this->_data['success'] = false;
		return $this;
	}