Class SimpleStub

Description

An empty collection of methods that can have their return values set. Used for prototyping.

Located in /libraries/pear/simpletest/mock_objects.php (line 416)


	
			
Direct descendents
Class Description
 class SimpleMock An empty collection of methods that can have their
 class SpecialSimpleStub An empty collection of methods that can have their return values set. Used for prototyping.
Variable Summary
Method Summary
 SimpleStub SimpleStub (mixed $wildcard, [boolean $is_strict = true])
 Number getCallCount (string $method)
 void setReturnReference (string $method, mixed &$reference, [array $args = false])
 void setReturnReferenceAt (integer $timing, string $method, mixed &$reference, [array $args = false])
 void setReturnValue (string $method, mixed $value, [array $args = false])
 void setReturnValueAt (integer $timing, string $method, mixed $value, [array $args = false])
 void _addCall (string $method, array $args)
 void _dieOnNoMethod (string $method, string $task)
 mixed &_getReturn (string $method, array $args, integer $step)
 mixed &_invoke (string $method, array $args)
 array _replaceWildcards (array $args)
Variables
mixed $_call_counts (line 421)
mixed $_is_strict (line 418)
mixed $_returns (line 419)
mixed $_return_sequence (line 420)
mixed $_wildcard (line 417)
Methods
Constructor SimpleStub (line 429)

Sets up the wildcard and everything else empty.

  • access: public
SimpleStub SimpleStub (mixed $wildcard, [boolean $is_strict = true])
  • mixed $wildcard: Parameter matching wildcard.
  • boolean $is_strict: Enables method name checks.
getCallCount (line 505)

Fetches the call count of a method so far.

  • return: of calls so far.
  • access: public
Number getCallCount (string $method)
  • string $method: Method name called.
setReturnReference (line 569)

Sets a return for a parameter list that will be passed by reference for all calls.

  • access: public
void setReturnReference (string $method, mixed &$reference, [array $args = false])
  • string $method: Method name.
  • mixed $reference: Result of the call will be this object.
  • array $args: List of parameters to match including wildcards.
setReturnReferenceAt (line 593)

Sets a return for a parameter list that will be passed by value only when the required call count is reached.

  • access: public
void setReturnReferenceAt (integer $timing, string $method, mixed &$reference, [array $args = false])
  • integer $timing: Number of calls in the future to which the result applies. If not set then all calls will return the value.
  • string $method: Method name.
  • mixed $reference: Result of the call will be this object.
  • array $args: List of parameters to match including wildcards.
setReturnValue (line 523)

Sets a return for a parameter list that will be passed by value for all calls to this method.

  • access: public
void setReturnValue (string $method, mixed $value, [array $args = false])
  • string $method: Method name.
  • mixed $value: Result of call passed by value.
  • array $args: List of parameters to match including wildcards.
setReturnValueAt (line 547)

Sets a return for a parameter list that will be passed by value only when the required call count is reached.

  • access: public
void setReturnValueAt (integer $timing, string $method, mixed $value, [array $args = false])
  • integer $timing: Number of calls in the future to which the result applies. If not set then all calls will return the value.
  • string $method: Method name.
  • mixed $value: Result of call passed by value.
  • array $args: List of parameters to match including wildcards.
_addCall (line 492)

Adds one to the call count of a method.

  • access: protected
void _addCall (string $method, array $args)
  • string $method: Method called.
  • array $args: Arguments as an array.
_dieOnNoMethod (line 478)

Triggers a PHP error if the method is not part of this object.

  • access: protected
void _dieOnNoMethod (string $method, string $task)
  • string $method: Name of method.
  • string $task: Description of task attempt.
_getReturn (line 617)

Finds the return value matching the incoming arguments. If there is no matching value found then an error is triggered.

  • return: Stored return.
  • access: protected
mixed &_getReturn (string $method, array $args, integer $step)
  • string $method: Method name.
  • array $args: Calling arguments.
  • integer $step: Current position in the call history.
_invoke (line 464)

Returns the expected value for the method name.

  • return: Stored return.
  • access: private
mixed &_invoke (string $method, array $args)
  • string $method: Name of method to simulate.
  • array $args: Arguments as an array.

Redefined in descendants as:
  • SimpleMock::_invoke() : Returns the expected value for the method name and checks expectations. Will generate any test assertions as a result of expectations if there is a test present.
_replaceWildcards (line 445)

Replaces wildcard matches with wildcard expectations in the argument list.

  • return: Argument list with expectations.
  • access: private
array _replaceWildcards (array $args)
  • array $args: Raw argument list.

Documentation generated on Fri, 11 Feb 2005 18:13:34 +0000 by phpDocumentor 1.3.0RC3