class PHPUnit_Framework_MockObject_Stub_ReturnArgument

Stubs a method by returning an argument that was passed to the mocked method.

@package PHPUnit_MockObject @author Sebastian Bergmann <sb@sebastian-bergmann.de> @copyright 2010-2013 Sebastian Bergmann <sb@sebastian-bergmann.de> @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License @version Release: @package_version@ @link http://github.com/sebastianbergmann/phpunit-mock-objects @since Class available since Release 1.0.0

Hierarchy

Expanded class hierarchy of PHPUnit_Framework_MockObject_Stub_ReturnArgument

File

drupal/core/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ReturnArgument.php, line 56

View source
class PHPUnit_Framework_MockObject_Stub_ReturnArgument extends PHPUnit_Framework_MockObject_Stub_Return {
  protected $argumentIndex;
  public function __construct($argumentIndex) {
    $this->argumentIndex = $argumentIndex;
  }
  public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) {
    if (isset($invocation->parameters[$this->argumentIndex])) {
      return $invocation->parameters[$this->argumentIndex];
    }
    else {
      return NULL;
    }
  }
  public function toString() {
    return sprintf('return argument #%d', $this->argumentIndex);
  }

}

Members