Changeset 1742

Show
Ignore:
Timestamp:
08/29/08 01:20:02 (4 months ago)
Author:
lmajano
Message:

Unit testing persist framework setting.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • coldbox/trunk/ApplicationTemplate/handlers/tests/cfcunit/generalTest.cfc

    r1547 r1742  
    77-----------------------------------------------------------------------> 
    88<cfcomponent name="generalTest" extends="coldbox.system.extras.testing.baseTest" output="false"> 
    9  
     9         
     10        <cfscript> 
     11                //Uncomment the following if you need the controller in application scope. 
     12                //this.PERSIST_FRAMEWORK = true; 
     13        </cfscript> 
     14         
    1015        <cffunction name="setUp" returntype="void" access="private" output="false"> 
    1116                <cfscript> 
  • coldbox/trunk/ApplicationTemplate/handlers/tests/cfcunit/mainTest.cfc

    r1547 r1742  
    99<cfcomponent name="mainTest" extends="coldbox.system.extras.testing.baseTest" output="false"> 
    1010 
     11        <cfscript> 
     12                //Uncomment the following if you need the controller in application scope. 
     13                //this.PERSIST_FRAMEWORK = true; 
     14        </cfscript> 
     15         
    1116        <cffunction name="setUp" returntype="void" access="private" output="false"> 
    1217                <cfscript> 
  • coldbox/trunk/ApplicationTemplate/handlers/tests/mxunit/generalTest.cfc

    r1547 r1742  
    77-----------------------------------------------------------------------> 
    88<cfcomponent name="generalTest" extends="coldbox.system.extras.testing.baseMXUnitTest" output="false"> 
     9         
     10        <cfscript> 
     11                //Uncomment the following if you need the controller in application scope. 
     12                //this.PERSIST_FRAMEWORK = true; 
     13        </cfscript> 
    914         
    1015        <cffunction name="setUp" returntype="void" access="public" output="false"> 
  • coldbox/trunk/ApplicationTemplate/handlers/tests/mxunit/mainTest.cfc

    r1547 r1742  
    88-----------------------------------------------------------------------> 
    99<cfcomponent name="mainTest" extends="coldbox.system.extras.testing.baseMXUnitTest" output="false"> 
     10         
     11        <cfscript> 
     12                //Uncomment the following if you need the controller in application scope. 
     13                //this.PERSIST_FRAMEWORK = true; 
     14        </cfscript> 
    1015         
    1116        <cffunction name="setup" returntype="void" access="public" output="false"> 
  • coldbox/trunk/system/extras/testing/baseMXUnitTest.cfc

    r1533 r1742  
    3131                instance.ConfigMapping = ""; 
    3232                instance.controller = ""; 
     33                /* Public Persistence Properties */ 
     34                this.PERSIST_FRAMEWORK = false; 
    3335        </cfscript> 
    3436 
     
    3840                instance.controller = CreateObject("component", "coldbox.system.testcontroller").init( expandPath(instance.AppMapping) ); 
    3941                instance.controller.getLoaderService().setupCalls(instance.ConfigMapping,instance.AppMapping); 
    40  
     42                 
     43                /* Verify Persistence */ 
     44                if( this.PERSIST_FRAMEWORK ){ 
     45                        application.cbController = instance.controller; 
     46                } 
     47                 
    4148                //Create Initial Event Context 
    4249                setupRequest(); 
    43                 //Clean up Initial Event Context due to MACH-II vars of the unit test framework. 
     50                 
     51                //Clean up Initial Event Context 
    4452                getRequestContext().clearCollection(); 
     53                </cfscript> 
     54        </cffunction> 
     55         
     56        <cffunction name="tearDown" access="public" returntype="void" hint="The teardown" output="false" > 
     57                <cfscript> 
     58                        if( this.PERSIST_FRAMEWORK ){ 
     59                                structDelete(application,"cbController"); 
     60                        } 
    4561                </cfscript> 
    4662        </cffunction> 
     
    7288        <!--- getter for controller ---> 
    7389        <cffunction name="getcontroller" access="private" returntype="any" output="false" hint="Get a reference to the ColdBox controller"> 
     90                <cfif this.PERSIST_FRAMEWORK> 
     91                        <cfset instance.controller = application.cbController> 
     92                </cfif> 
    7493                <cfreturn instance.controller> 
    7594        </cffunction> 
  • coldbox/trunk/system/extras/testing/baseTest.cfc

    r1533 r1742  
    3333                instance.ConfigMapping = ""; 
    3434                instance.controller = ""; 
     35                /* Public Persistence Properties */ 
     36                this.PERSIST_FRAMEWORK = false; 
    3537        </cfscript> 
    3638 
     
    4042                instance.controller = CreateObject("component", "coldbox.system.testcontroller").init( expandPath(instance.AppMapping) ); 
    4143                instance.controller.getLoaderService().setupCalls(instance.ConfigMapping,instance.AppMapping); 
    42  
     44                 
     45                /* Verify Persistence */ 
     46                if( this.PERSIST_FRAMEWORK ){ 
     47                        application.cbController = instance.controller; 
     48                } 
     49                 
    4350                //Create Initial Event Context 
    4451                setupRequest(); 
    45                 //Clean up Initial Event Context due to MACH-II vars of the unit test framework. 
     52                 
     53                //Clean up Initial Event Context 
    4654                getRequestContext().clearCollection(); 
     55                </cfscript> 
     56        </cffunction> 
     57         
     58        <cffunction name="tearDown" access="public" returntype="void" hint="The teardown" output="false" > 
     59                <cfscript> 
     60                        if( this.PERSIST_FRAMEWORK ){ 
     61                                structDelete(application,"cbController"); 
     62                        } 
    4763                </cfscript> 
    4864        </cffunction> 
     
    7490        <!--- getter for controller ---> 
    7591        <cffunction name="getcontroller" access="private" returntype="any" output="false" hint="Get a reference to the ColdBox controller"> 
     92                <cfif this.PERSIST_FRAMEWORK> 
     93                        <cfset instance.controller = application.cbController> 
     94                </cfif> 
    7695                <cfreturn instance.controller> 
    7796        </cffunction> 

Copyright 2006 ColdBox Framework by Luis Majano