I have an interceptor which does a "am i logged in" check preprocess,
as well as a few custom interception points for things like
"checkAdmin"..    I'm wanting to test these obviously, but i'm getting
an error stating: Variable CONTROLLER is undefined..    My test is as
follows:
  <cffunction name="testPreProcessAccessCheck" returntype="void"
output="false">
    <cfscript>
    var event = getMockRequestContext();
    session.pid = '';
    interceptor.preprocess(getMockRequestContext(), structNew());
    assertEquals("general.login", event.getValue("setnextevent",""),
"Relocation Test");
    </cfscript>
  </cffunction>
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              i should also note the error is getting thrown on this line in my
interceptor:
<cfset setNextEvent('general.login')>
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              Can you please post the entire test CFC. The answer is likely in the inheritance.
Thanks,
Aaron
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              TEST CASE:
<cfcomponent extends="coldbox.system.testing.BaseInterceptorTest"
output="false" interceptor="uncSkeleton.interceptors.authentication">
  <cffunction name="setUp" returntype="void" output="false">
    <cfscript>
      super.setup();
    </cfscript>
  </cffunction>
  <cffunction name="testConfigure" returntype="void" output="false">
    <cfscript>
    interceptor.configure();
    </cfscript>
  </cffunction>
  <cffunction name="testPreProcessAccessCheck" returntype="void"
output="false">
    <cfscript>
    var event = getMockRequestContext();
    session.pid = '';
    interceptor.preprocess(getMockRequestContext(), structNew());
    assertEquals("general.login", event.getValue("setnextevent",""),
"Relocation Test");
    </cfscript>
  </cffunction>
</cfcomponent>
AUTH INTERCEPTOR CFC:
<cfcomponent name="authInterceptor"	output="false">
  <cffunction name="Configure" access="public" returntype="void"
hint="This is the configuration method for your interceptor"
output="false" >
  </cffunction>
  <cffunction name="preProcess" access="public" returntype="void"
hint="Executes after the framework and application configuration
loads, but before the aspects get configured. " output="false" >
    <cfargument name="event" required="true"  hint="The event object.">
    <cfargument name="interceptData" required="true" type="struct"
hint="interceptData of intercepted info.">
    <cfset var rc = event.getCollection()>
    <cfparam name="session.pid" default="0">
    <!--- process login request --->
    <Cfif structKeyExists(rc, 'login')>
      <cfset announceInterception('handleLogin')>
    </Cfif>
    <!--- MUST BE LOGGED IN! --->
    <cfif (session.pid eq 0 or session.pid eq '') and
listFindNoCase('general.login', event.getCurrentEvent()) eq 0>
      <cfif not isdefined('url.logout') and not isdefined('url.login')
and cgi.script_name does not contain 'shib'>
        <cfset session.targetURL = "#CGI.SCRIPT_NAME#?#CGI.QUERY_STRING#">
      </cfif>
      <cfset setNextEvent('general.login')>
    </cfif>
  </cffunction>
</cfcomponent>