Class: MockObject

Represents a Mock object in which stubs for member functions and variables need to be specified.

Constructor

Gets invoked during the mock object preparation.

init (object{}  mockObject)
  • mockObject object{}
  • Object to register stubbing

Methods

when

Allows a member function to stub.

getMember

Allows a member variable to stub.

when

function when(string functionName) returns MemberFunctionStub
Isolated Function

Allows a member function to stub.

Parameters

  • functionName string
  • Function name to allow stubbing

Return Type

(MemberFunctionStub)

Object that allows stubbing calls to provided member function

getMember

function getMember(string fieldName) returns MemberVariableStub
Isolated Function

Allows a member variable to stub.

Parameters

  • fieldName string
  • Field name to allow stubbing

Return Type

(MemberVariableStub)

Object that allows stubbing retrieval of provided member variable