-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMockDebug.cfc
58 lines (45 loc) · 1.22 KB
/
MockDebug.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<cfcomponent>
<!---
to do: pretty print info about the currently mocked object
What's important to print?
Name of Object being mocked,
Is it a spy?
Is it simple or type safe?
What are the registered behaviors?
What has been invoked?
Idea: Display tree:
Mock Name: foo.bar
Registered Mock Methods (query):
Method Name:
ID:
Parameters
For each param in args, print name,value
Type:
Returns:
Throws:
Time Registered
Invocaction Record:
ID:
Parameters
For each param in args, print name,value
Matched Patter:
Status:
Time:
verbose: above plus + display raw
Must be fast!
--->
<cfscript>
function debug(mock,verbose){
var mockBug = {};
var registry = mock._$getRegistry();
structInsert(mockBug," MockName", mock.getMocked().name );
structInsert(mockBug, 'Mocked Methods', registry.getRegistry());
structInsert(mockBug, 'Invocation Records', registry.invocationRecord);
structInsert(mockBug, 'Returns and Throws Data' , registry.registryDataMap);
structInsert(mockBug, 'Method Arguments' , registry.argMap);
return mockBug;
}
function printRegistryDebug(reg) {
}
</cfscript>
</cfcomponent>