@@ -13,8 +13,14 @@ component extends="coldbox.system.testing.BaseInterceptorTest" interceptor="cbse
13
13
// setup properties
14
14
setup ();
15
15
variables .wirebox = new coldbox .system .ioc .Injector ();
16
- mockController .$( " getAppHash" , hash ( " appHash" ) ).$( " getAppRootPath" , expandPath ( " /root" ) );
17
- security = interceptor ;
16
+ mockController
17
+ .$( " getAppHash" , hash ( " appHash" ) )
18
+ .$( " getAppRootPath" , expandPath ( " /root" ) )
19
+ .$( " getColdboxSettings" , {
20
+ " version" : " 6.0.0"
21
+ }, false );
22
+ security = interceptor ;
23
+ security .setInvalidEventHandler ( ' ' );
18
24
settings = {
19
25
// The global invalid authentication event or URI or URL to go if an invalid authentication occurs
20
26
" invalidAuthenticationEvent" : " " ,
@@ -131,7 +137,32 @@ component extends="coldbox.system.testing.BaseInterceptorTest" interceptor="cbse
131
137
expect ( function (){
132
138
security .configure ();
133
139
} ).toThrow ( " Security.ValidatorMethodException" );
134
- } );
140
+ } );
141
+
142
+ it ( " does not enable invalid event handler processing on Coldbox versions 6+" , function () {
143
+ security .setProperties ( settings );
144
+ security
145
+ .$( " getInstance" )
146
+ .$args ( settings .validator )
147
+ .$results ( wirebox .getInstance ( settings .validator ) );
148
+ security .configure ();
149
+ expect ( security .$getProperty ( " enableInvalidHandlerCheck" ) ).toBeFalse ();
150
+ } );
151
+
152
+ it ( " enables invalid event handler processing on Coldbox versions prior to 6" , function () {
153
+
154
+ mockController .$( " getColdboxSettings" , {
155
+ " version" : " 5.0.0"
156
+ }, false );
157
+
158
+ security .setProperties ( settings );
159
+ security
160
+ .$( " getInstance" )
161
+ .$args ( settings .validator )
162
+ .$results ( wirebox .getInstance ( settings .validator ) );
163
+ security .configure ();
164
+ expect ( security .$getProperty ( " enableInvalidHandlerCheck" ) ).toBeTrue ();
165
+ } );
135
166
136
167
describe ( " It can load many types of rules" , function (){
137
168
beforeEach ( function (currentSpec ){
@@ -173,7 +204,8 @@ component extends="coldbox.system.testing.BaseInterceptorTest" interceptor="cbse
173
204
174
205
expect ( security .getProperty ( " rules" , [] ) ).toHaveLength ( 1 );
175
206
} );
176
- } );
207
+ } );
208
+
177
209
} );
178
210
}
179
211
0 commit comments