labs.mock.MockManager_ Extends
Base class that provides basic functionality for creating, adding and finding bindings, offering an executor method that is called when a call to the stub is made, an array to hold the bindings and the mocked item, among other things.

Inheritance

Constructor

goog.labs.mock.MockManager_()

Instance Methods

Public Protected Private
addBinding(methodNameargsfunc)
Adds a binding for the method name and arguments to be stubbed.
Arguments:
methodName : ?string
The name of the stubbed method.
args : !Array
The arguments passed to the method.
func : !Function
The stub function.
code »
executeStub(methodNamevar_args) *
Looks up the list of stubs defined on the mock object and executes the function associated with that stub.
Arguments:
methodName : string
The name of the method to execute.
var_args : ...
The arguments passed to the method.
Returns: *  Value returned by the stub function.
code »
findBinding(methodNameargs) Function
Returns a stub, if defined, for the method name and arguments passed in.
Arguments:
methodName : string
The name of the stubbed method.
args : !Array
The arguments passed to the method.
Returns: Function  The stub function or undefined.
code »
getExecutor(methodNameargs) Function
Returns a stub, if defined, for the method name and arguments passed in as parameters.
Arguments:
methodName : string
The name of the stubbed method.
args : !Array
The arguments passed to the method.
Returns: Function  The stub function or undefined.
code »
getMockedItem() !Object | !Function
Returns the mock object. This should have a stubbed method for each method on the object being mocked.
Returns: !Object | !Function  The mock object.
code »
handleMockCall_(methodNamevar_args) !goog.labs.mock.StubBinder_
Handles the first step in creating a stub, returning a stub-binder that is later used to bind a stub for a method.
Arguments:
methodName : string
The name of the method being bound.
var_args : ...
The arguments to the method.
Returns: !goog.labs.mock.StubBinder_  The stub binder.
code »
recordCall_(methodNameargs)
Records a call to 'methodName' with arguments 'args'.
Arguments:
methodName : string
The name of the called method.
args : !Array
The array of arguments.
code »
verifyInvocation(methodNamevar_args)
Verify invocation of a method with specific arguments.
Arguments:
methodName : string
The name of the method.
var_args : ...
The arguments passed.
code »

Instance Properties

$stubBinder :
Holds a reference to the binder used to define stubs.
Code »
callRecords_ :
Record method calls with no stub definitions.
Code »
methodBindings :
Holds the stub bindings established so far.
Code »
mockedItem :
Proxies the methods for the mocked object or class to execute the stubs.
Code »
mockee :
A reference to the object or function being mocked.
Code »

Package labs.mock

Package Reference