Show
Ignore:
Timestamp:
05/28/07 20:16:29 (6 years ago)
Author:
lmajano
Message:

Ticket #168
Unit tests complete

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • coldbox/trunk/ApplicationTemplate/handlers/tests/ehMainTest.cfc

    r688 r697  
    11<!----------------------------------------------------------------------- 
    2 Author   :      Your Name 
     2Author   :      ehMainTest.cfc 
    33Date     :      September 25, 2005 
    44Description : 
    55 
    6 Unit test for the ehMain Handler. 
     6        Unit test for the ehMain Handler. 
    77 
    88-----------------------------------------------------------------------> 
     
    1010 
    1111        <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> 
    1322        </cffunction> 
    1423 
    1524        <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> 
    1735        </cffunction> 
    1836 
    1937        <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> 
    2148        </cffunction> 
    2249 
    2350        <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 
    2465 
     66                </cfscript> 
    2567        </cffunction> 
    2668