lucee.Component
testbox.system.mockutils.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=''], [string throwErrorCode=''], any metadata='', any targetObject, [boolean callLogging='false'], [boolean preserveArguments='false'], [any callback])
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. |
void
|
writeStub(string genPath, string code)
Write a method generator stub. |
| Methods inherited from class lucee.Component |
|---|
| None |
| Constructor Detail |
|---|
Constructor
mockBoxremoveStubs - Always remove stubs unless we are debugging| Method Detail |
|---|
Mix in a template
templatePathGenerate a mock method and return the generated path
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 throwthrowErrorCode - The errorCode 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.callback - A callback to execute that should return the desired results, this can be a UDF or closure.Generate CFC's according to specs
extends - The class the CFC should extendimplements - The class(es) the CFC should implementGenerates methods from functions metadata
buffer - The string buffer to append stuff tomd - The metadata to generateRemove a method generator stub
genPathWrite a method generator stub
genPathcode