testing.MockControl Extends
Controls a set of mocks. Controlled mocks are replayed, verified, and cleaned-up at the same time.

Inheritance

Constructor

goog.testing.MockControl()

Instance Methods

Public Protected Private
$replayAll()
Calls replay on each controlled mock.
code »
$resetAll()
Calls reset on each controlled mock.
code »
$tearDown()
Calls tearDown on each controlled mock, if necesssary.
code »
$verifyAll()
Calls verify on each controlled mock.
code »
addMock(mock) goog.testing.MockInterface
Takes control of this mock.
Arguments:
mock : goog.testing.MockInterface
Mock to be controlled.
Returns: goog.testing.MockInterface  The same mock passed in, for convenience.
code »
createConstructorMock(scopeconstructorNameopt_strictness) !goog.testing.MockInterface
Creates a controlled MethodMock for a constructor. Passes its arguments through to the MethodMock constructor. See goog.testing.createConstructorMock for details.
Arguments:
scope : Object
The scope of the constructor to be mocked out.
constructorName : string
The name of the function we're going to mock.
opt_strictness : number=
One of goog.testing.Mock.LOOSE or goog.testing.Mock.STRICT. The default is STRICT.
Returns: !goog.testing.MockInterface  The mocked method.
code »
createFunctionMock(opt_functionNameopt_strictness) goog.testing.MockInterface
Creates a controlled FunctionMock. Passes its arguments through to the FunctionMock constructor.
Arguments:
opt_functionName : string=
The optional name of the function to mock set to '[anonymous mocked function]' if not passed in.
opt_strictness : number=
One of goog.testing.Mock.LOOSE or goog.testing.Mock.STRICT. The default is STRICT.
Returns: goog.testing.MockInterface  The mocked function.
code »
createGlobalFunctionMock(functionNameopt_strictness) goog.testing.MockInterface
Creates a controlled GlobalFunctionMock. Passes its arguments through to the GlobalFunctionMock constructor.
Arguments:
functionName : string
The name of the function we're going to mock.
opt_strictness : number=
One of goog.testing.Mock.LOOSE or goog.testing.Mock.STRICT. The default is STRICT.
Returns: goog.testing.MockInterface  The mocked function.
code »
createLooseMock(objectToMockopt_ignoreUnexpectedCallsopt_mockStaticMethodsopt_createProxy) !goog.testing.LooseMock
Creates a controlled LooseMock. Passes its arguments through to the LooseMock constructor.
Arguments:
objectToMock : Object | Function
The object that should be mocked, or the constructor of an object to mock.
opt_ignoreUnexpectedCalls : boolean=
Whether to ignore unexpected calls.
opt_mockStaticMethods : boolean=
An optional argument denoting that a mock should be constructed from the static functions of a class.
opt_createProxy : boolean=
An optional argument denoting that a proxy for the target mock should be created.
Returns: !goog.testing.LooseMock  The mock object.
code »
createMethodMock(scopefunctionNameopt_strictness) !goog.testing.MockInterface
Creates a controlled MethodMock. Passes its arguments through to the MethodMock constructor.
Arguments:
scope : Object
The scope of the method to be mocked out.
functionName : string
The name of the function we're going to mock.
opt_strictness : number=
One of goog.testing.Mock.LOOSE or goog.testing.Mock.STRICT. The default is STRICT.
Returns: !goog.testing.MockInterface  The mocked method.
code »
createStrictMock(objectToMockopt_mockStaticMethodsopt_createProxy) !goog.testing.StrictMock
Creates a controlled StrictMock. Passes its arguments through to the StrictMock constructor.
Arguments:
objectToMock : Object | Function
The object that should be mocked, or the constructor of an object to mock.
opt_mockStaticMethods : boolean=
An optional argument denoting that a mock should be constructed from the static functions of a class.
opt_createProxy : boolean=
An optional argument denoting that a proxy for the target mock should be created.
Returns: !goog.testing.StrictMock  The mock object.
code »

Instance Properties

mocks_ :
The list of mocks being controlled.
Code »

Package testing

Package Reference