-
-
Notifications
You must be signed in to change notification settings - Fork 172
/
Copy pathBaseModelTest.cfc
38 lines (32 loc) · 1.07 KB
/
BaseModelTest.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
* www.ortussolutions.com
* ---
* Standalone base test case for model objects
*/
component extends="coldbox.system.testing.BaseTestCase" {
this.loadColdbox = false;
/**
* Setup a model to test
*/
function setup(){
var md = getMetadata( this );
var mockBox = getMockBox();
// Load ColdBox?
if ( this.loadColdBox ) {
super.setup();
}
// Check for model path annotation, and use it if declared.
if ( structKeyExists( md, "model" ) ) {
// Create model with Mocking capabilities
variables.model = mockBox.createMock( md.model );
}
// Create Mock Objects
variables.mockLogBox = mockBox.createEmptyMock( "coldbox.system.logging.LogBox" );
variables.mockLogger = mockBox.createEmptyMock( "coldbox.system.logging.Logger" );
variables.mockCacheBox = mockBox.createEmptyMock( "coldbox.system.cache.CacheFactory" );
variables.mockWireBox = mockBox
.createMock( "coldbox.system.ioc.Injector" )
.init( { scopeRegistration : { enabled : false } } );
}
}