- Timestamp:
- 05/28/07 20:16:29 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
coldbox/trunk/ApplicationTemplate/handlers/tests/ehMainTest.cfc
r688 r697 1 1 <!----------------------------------------------------------------------- 2 Author : Your Name2 Author : ehMainTest.cfc 3 3 Date : September 25, 2005 4 4 Description : 5 5 6 Unit test for the ehMain Handler.6 Unit test for the ehMain Handler. 7 7 8 8 -----------------------------------------------------------------------> … … 10 10 11 11 <cffunction name="testonAppInit" access="public" returntype="void" output="false"> 12 12 <cfscript> 13 var event = ""; 14 15 //Place any variables on the form or URL scope to test the handler. 16 //FORM.name = "luis" 17 event = execute("ehMain.onAppInit"); 18 19 //Do your asserts below 20 21 </cfscript> 13 22 </cffunction> 14 23 15 24 <cffunction name="testonRequestStart" access="public" returntype="void" output="false"> 16 25 <cfscript> 26 var event = ""; 27 28 //Place any variables on the form or URL scope to test the handler. 29 //FORM.name = "luis" 30 event = execute("ehMain.onRequestStart"); 31 32 //Do your asserts below 33 34 </cfscript> 17 35 </cffunction> 18 36 19 37 <cffunction name="testonRequestEnd" access="public" returntype="void" output="false"> 20 38 <cfscript> 39 var event = ""; 40 41 //Place any variables on the form or URL scope to test the handler. 42 //FORM.name = "luis" 43 event = execute("ehMain.onRequestEnd"); 44 45 //Do your asserts below 46 47 </cfscript> 21 48 </cffunction> 22 49 23 50 <cffunction name="testonException" access="public" returntype="void" output="false"> 51 <cfscript> 52 //You need to create an exception bean first and place it on the request context FIRST as a setup. 53 var exceptionBean = CreateObject("component","coldbox.system.beans.exceptionBean"); 54 var event = ""; 55 56 //Initialize an exception 57 exceptionBean.init(erroStruct=structnew(), extramessage="My unit test exception", extraInfo="Any extra info, simple or complex"); 58 //Place it on form or url scope to attach it to request 59 FORM.exceptionBean = exceptionBean; 60 61 //TEST EVENT EXECUTION 62 event = execute("ehMain.onException"); 63 64 //Do your asserts HERE 24 65 66 </cfscript> 25 67 </cffunction> 26 68
