You are here

class PHPUnit_Framework_MockObject_Stub_ReturnSelf in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ReturnSelf.php \PHPUnit_Framework_MockObject_Stub_ReturnSelf

Stubs a method by returning the current object.

@since Class available since Release 1.1.0

Hierarchy

Expanded class hierarchy of PHPUnit_Framework_MockObject_Stub_ReturnSelf

File

vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ReturnSelf.php, line 16

View source
class PHPUnit_Framework_MockObject_Stub_ReturnSelf implements PHPUnit_Framework_MockObject_Stub {
  public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) {
    if (!$invocation instanceof PHPUnit_Framework_MockObject_Invocation_Object) {
      throw new PHPUnit_Framework_Exception('The current object can only be returned when mocking an ' . 'object, not a static class.');
    }
    return $invocation->object;
  }
  public function toString() {
    return 'return the current object';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PHPUnit_Framework_MockObject_Stub_ReturnSelf::invoke public function Fakes the processing of the invocation $invocation by returning a specific value. Overrides PHPUnit_Framework_MockObject_Stub::invoke
PHPUnit_Framework_MockObject_Stub_ReturnSelf::toString public function Returns a string representation of the object. Overrides PHPUnit_Framework_SelfDescribing::toString