functionmock.js
No description.

File Location

/goog/testing/functionmock.js


Public Protected Private

Global Functions

goog.testing.MethodMock.$tearDown()
Resets the global function that we mocked back to its original state.
code »
goog.testing.FunctionMock(opt_functionNameopt_strictness) goog.testing.MockInterface
Class used to mock a function. Useful for mocking closures and anonymous callbacks etc. Creates a function object that extends goog.testing.Mock.
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 »
goog.testing.GlobalFunctionMock(functionNameopt_strictness) !goog.testing.MockInterface
Mocks a global / top-level function. Creates a goog.testing.MethodMock in the global scope with the name specified by functionName.
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 global function.
code »
goog.testing.MethodMock(scopefunctionNameopt_strictness) !goog.testing.MockInterface
Mocks an existing function. Creates a goog.testing.FunctionMock and registers it in the given scope with the name specified by functionName.
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 »
goog.testing.createConstructorMock(scopeconstructorNameopt_strictness) !goog.testing.MockInterface
Convenience method for creating a mock for a constructor. Copies class members to the mock.

When mocking a constructor to return a mocked instance, remember to create the instance mock before mocking the constructor. If you mock the constructor first, then the mock framework will be unable to examine the prototype chain when creating the mock instance.

Arguments:
scope : Object
The scope of the constructor to be mocked out.
constructorName : string
The name of the constructor 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 constructor.
code »
goog.testing.createFunctionMock(opt_functionNameopt_strictness) goog.testing.MockInterface
Convenience method for creating a mock for a function.
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 »
goog.testing.createGlobalFunctionMock(functionNameopt_strictness) goog.testing.MockInterface
Convenience method for creating a mocks for a global / top-level function.
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 global function.
code »
goog.testing.createMethodMock(scopefunctionNameopt_strictness) !goog.testing.MockInterface
Convenience method for creating a mock for a method.
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 global function.
code »
goog.testing.FunctionMock&fn()
No description.
code »

Directory testing

File Reference