|
ColdBox Platform v3.8.0 | ||||
FRAMES |
WEB-INF.cftags.componentcoldbox.system.testing.mockutils.MockGenerator
public class MockGenerator
The guy in charge of creating mocks
Constructor Summary | |
---|---|
init(any mockBox, [any removeStubs='true'])
Constructor |
Method Summary | |
---|---|
private void |
$include(string templatePath)
Mix in a template |
string |
generate(string method, [any returns], boolean preserveReturnType='true', [boolean throwException='false'], [string throwType=''], [string throwDetail=''], [string throwMessage=''], any metadata='', any targetObject, [boolean callLogging='false'], [boolean preserveArguments='false'])
Generate a mock method and return the generated path |
any |
generateCFC([string extends=''], [string implements=''])
Generate CFC's according to specs |
private any |
generateMethodsFromMD(any buffer, any md)
Generates methods from functions metadata |
boolean |
removeStub(string genPath)
Remove a method generator stub |
private void |
rethrowit(any throwObject)
Rethrow an exception |
void |
writeStub(string genPath, string code)
Write a method generator stub |
Methods inherited from class WEB-INF.cftags.component |
---|
None
|
Constructor Detail |
---|
public init(any mockBox, [any removeStubs='true'])
mockBox
removeStubs
- Always remove stubs unless we are debuggingMethod Detail |
---|
private void $include(string templatePath)
templatePath
public string generate(string method, [any returns], boolean preserveReturnType='true', [boolean throwException='false'], [string throwType=''], [string throwDetail=''], [string throwMessage=''], any metadata='', any targetObject, [boolean callLogging='false'], [boolean preserveArguments='false'])
method
- The method you want to mock or spy onreturns
- The results it must return, if not passed it returns void or you will have to do the mockResults() chainpreserveReturnType
- If false, the mock will make the returntype of the method equal to ANYthrowException
- If you want the method call to throw an exceptionthrowType
- The type of the exception to throwthrowDetail
- The detail of the exception to throwthrowMessage
- The message of the exception to throwmetadata
- The function metadatatargetObject
- The target object to mix incallLogging
- Will add the machinery to also log the incoming arguments to each subsequent calls to this methodpreserveArguments
- If true, argument signatures are kept, else they are ignored. If true, BEWARE with $args() matching as default values and missing arguments need to be passed too.public any generateCFC([string extends=''], [string implements=''])
extends
- The class the CFC should extendimplements
- The class(es) the CFC should implementprivate any generateMethodsFromMD(any buffer, any md)
buffer
- The string buffer to append stuff tomd
- The metadata to generatepublic boolean removeStub(string genPath)
genPath
private void rethrowit(any throwObject)
throwObject
- The exception objectpublic void writeStub(string genPath, string code)
genPath
code
|
ColdBox Platform v3.8.0 | ||||
FRAMES |