";
throw( type='FW1.viewNotFound', message="Unable to find a view for '#request.action#' action.",
- detail="'#request.missingView#' does not exist." );
+ detail="'#request.missingView#' does not exist." );
}
}
diff --git a/introduction/layouts/default.cfm b/introduction/layouts/default.cfm
index e9da1cee..0283b989 100644
--- a/introduction/layouts/default.cfm
+++ b/introduction/layouts/default.cfm
@@ -11,7 +11,7 @@
#body#
diff --git a/introduction/views/main/default.cfm b/introduction/views/main/default.cfm
index 093ac542..9cc61209 100644
--- a/introduction/views/main/default.cfm
+++ b/introduction/views/main/default.cfm
@@ -1,9 +1,9 @@
Welcome to Framework One!
#view('about/default')#
Documentation
-The documentation for FW/1 can be found on its github wiki page.
- The latest news about FW/1 can always be found on its RIAForge project page
- which also has links to the mailing list and
- blog.
+Read the documentation for FW/1.
+ The latest news can always be found on the FW/1 blog
+ which also has links to the FW/1 mailing list
+ and other avenues for community support.
Examples
#view('main/examples')#
diff --git a/tests/AddBeanTest.cfc b/tests/AddBeanTest.cfc
index 87aee3ed..9937d57c 100644
--- a/tests/AddBeanTest.cfc
+++ b/tests/AddBeanTest.cfc
@@ -3,7 +3,7 @@ component extends="mxunit.framework.TestCase" {
function setup() {
variables.added =
new framework.ioc( "" )
- .addBean( "known", 42 );
+ .declare( "known" ).asValue( 42 ).done();
}
function shouldHaveKnownValue() {
diff --git a/tests/BeanInfoTest.cfc b/tests/BeanInfoTest.cfc
index 726a20e7..68b0b7c3 100644
--- a/tests/BeanInfoTest.cfc
+++ b/tests/BeanInfoTest.cfc
@@ -29,7 +29,7 @@ component extends="mxunit.framework.TestCase" {
function shouldBeFlat() {
var parent = new framework.ioc( "" );
- parent.addBean( "father", "figure" );
+ parent.declare( "father" ).asValue( "figure" );
variables.factory.setParent( parent );
var info = variables.factory.getBeanInfo( flatten = true );
assertFalse( structKeyExists( info, "parent" ) );
@@ -38,8 +38,9 @@ component extends="mxunit.framework.TestCase" {
}
function shouldMatchRegex() {
- variables.factory.addBean( "father", "figure" );
- variables.factory.addBean( "mother", "figure" );
+ variables.factory
+ .declare( "father" ).asValue( "figure" ).done()
+ .addBean( "mother", "figure" );
var info = variables.factory.getBeanInfo( regex = "her$" );
assertEquals( 2, structCount( info.beaninfo ) );
assertTrue( structKeyExists( info.beaninfo, "father" ) );
diff --git a/tests/DeclareBeanTest.cfc b/tests/DeclareBeanTest.cfc
index 5359587e..0f0df62c 100644
--- a/tests/DeclareBeanTest.cfc
+++ b/tests/DeclareBeanTest.cfc
@@ -1,7 +1,8 @@
component extends="mxunit.framework.TestCase" {
function shouldDeclareSingleton() {
- var bf = new framework.ioc( "" ).declareBean( "foo", "tests.extrabeans.sheep.item" );
+ var bf = new framework.ioc( "" )
+ .declare( "foo" ).instanceOf( "tests.extrabeans.sheep.item" ).done();
structDelete( application, "itemCount" );
var item1 = bf.getBean( "foo" );
assertEquals( 1, application.itemCount );
@@ -11,7 +12,11 @@ component extends="mxunit.framework.TestCase" {
}
function shouldDeclareTransient() {
- var bf = new framework.ioc( "" ).declareBean( "foo", "tests.extrabeans.sheep.item", false );
+ var bf = new framework.ioc( "" )
+ .declare( "foo" )
+ .instanceOf( "tests.extrabeans.sheep.item" )
+ .asTransient()
+ .done();
structDelete( application, "itemCount" );
var item1 = bf.getBean( "foo" );
assertEquals( 1, application.itemCount );
@@ -21,7 +26,11 @@ component extends="mxunit.framework.TestCase" {
}
function shouldDeclareSingletonWithOverride() {
- var bf = new framework.ioc( "" ).declareBean( "foo", "tests.extrabeans.sheep.item", true, { start = 100 } );
+ var bf = new framework.ioc( "" )
+ .declare( "foo" )
+ .instanceOf( "tests.extrabeans.sheep.item" )
+ .withOverrides( { start = 100 } )
+ .done();
structDelete( application, "itemCount" );
var item1 = bf.getBean( "foo" );
assertEquals( 101, application.itemCount );
@@ -31,7 +40,12 @@ component extends="mxunit.framework.TestCase" {
}
function shouldDeclareTransientWithOverride() {
- var bf = new framework.ioc( "" ).declareBean( "foo", "tests.extrabeans.sheep.item", false, { start = 100 } );
+ var bf = new framework.ioc( "" )
+ .declare( "foo" )
+ .instanceOf( "tests.extrabeans.sheep.item" )
+ .asTransient()
+ .withOverrides( { start = 100 } )
+ .done();
structDelete( application, "itemCount" );
var item1 = bf.getBean( "foo" );
assertEquals( 101, application.itemCount );
@@ -41,18 +55,35 @@ component extends="mxunit.framework.TestCase" {
}
function shouldDeclareAndAdd() {
- var bf = new framework.ioc( "" ).declareBean( "foo", "tests.declared.things.myconfig" ).addBean( "name", "test" ).addBean( "config", "some" );
+ var bf = new framework.ioc( "", { omitTypedProperties = false } )
+ .declare( "foo" ).instanceOf( "tests.declared.things.myconfig" ).done()
+ .declare( "name" ).asValue( "test" ).done()
+ .declare( "config" ).asValue( "some" ).done();
var item = bf.getBean( "foo" );
assertEquals( "test", item.getName() );
assertEquals( "some", item.getConfig() );
}
function shouldDeclareWithOverride() {
- var bf = new framework.ioc( "" ).declareBean( "foo", "tests.declared.things.myconfig", true, { name = "test", config = "some" } )
+ var bf = new framework.ioc( "", { omitTypedProperties = false } )
+ .declare( "foo" )
+ .instanceOf( "tests.declared.things.myconfig" )
+ .withOverrides( { name = "test", config = "some" } ).done()
.addBean( "name", "not-test" ).addBean( "config", "config" );
var item = bf.getBean( "foo" );
assertEquals( "test", item.getName() );
assertEquals( "some", item.getConfig() );
}
+ function shouldDeclareInteractWithDefault() {
+ var bf = new framework.ioc( "", { omitDefaultedProperties = false } ).declareBean( "foo", "tests.declared.things.myconfig" )
+ .addBean( "dftname", "injected" );
+ var item = bf.getBean( "foo" );
+ assertEquals( "injected", item.getDftName() );
+ var bf = new framework.ioc( "", { omitDefaultedProperties = true } ).declareBean( "foo", "tests.declared.things.myconfig" )
+ .addBean( "dftname", "injected" );
+ var item = bf.getBean( "foo" );
+ assertEquals( "default", item.getDftName() );
+ }
+
}
diff --git a/tests/FactoryBeanTest.cfc b/tests/FactoryBeanTest.cfc
index 945ee3bf..162ec4d6 100644
--- a/tests/FactoryBeanTest.cfc
+++ b/tests/FactoryBeanTest.cfc
@@ -2,7 +2,15 @@ component extends="mxunit.framework.TestCase" {
function shouldSupportBasicFactoryMethod() {
var bf = new framework.ioc( "/tests/model" );
- bf.factoryBean( "a", "factory", "makeMeAnA" );
+ bf.declare( "a" ).fromFactory( "factory", "makeMeAnA" );
+ assertEquals( "I am an A", bf.getBean( "a" ) );
+ }
+
+ function shouldSupportFactoryFunction() {
+ var bf = new framework.ioc( "/tests/model" );
+ bf.declare( "a" ).fromFactory( function() {
+ return "I am an A";
+ } );
assertEquals( "I am an A", bf.getBean( "a" ) );
}
@@ -15,14 +23,18 @@ component extends="mxunit.framework.TestCase" {
function shouldSupportFactoryMethodWithBeanArg() {
var bf = new framework.ioc( "/tests/model" );
- bf.factoryBean( "a", "factory", "makeAWithFava", [ "favaBean" ] );
+ bf.declare( "a" )
+ .fromFactory( "factory", "makeAWithFava" )
+ .withArguments( [ "favaBean" ] );
assertEquals( "I am a fava bean", bf.getBean( "a" ) );
}
function shouldSupportFactoryMethodWithLocalArg() {
var bf = new framework.ioc( "/tests/model" );
- bf.factoryBean( "a", "factory", "makeAWithFava", [ "favaBean" ],
- { favaBean = { stamp = "different" } } );
+ bf.declare( "a" )
+ .fromFactory( "factory", "makeAWithFava" )
+ .withArguments( [ "favaBean" ] )
+ .withOverrides( { favaBean = { stamp = "different" } } );
assertEquals( "I am a different bean", bf.getBean( "a" ) );
}
diff --git a/tests/TransientInjectionTest.cfc b/tests/TransientInjectionTest.cfc
new file mode 100644
index 00000000..9a8d70c0
--- /dev/null
+++ b/tests/TransientInjectionTest.cfc
@@ -0,0 +1,22 @@
+component extends="mxunit.framework.TestCase" {
+
+ function shouldReturnWiredTransient() {
+ // issue #420
+ var bf = new framework.ioc( "" );
+ bf.declareBean("transient", "tests.issue420.transient", false);
+ bf.declareBean("singleton", "tests.issue420.singleton", true);
+
+ assertTrue( bf.containsBean( "transient" ) );
+ assertFalse( bf.isSingleton( "transient" ) );
+
+ var singleton = bf.getBean( "transient" ).getSingleton();
+ assertTrue( isValid( "component", singleton ), "should return the singleton instance on the 1st call" );
+ assertTrue( isValid( "component", singleton.getBeanFactory() ), "should return ioc instance on the 1st call" );
+
+ // call again to check subsequent calls return wired transient
+ singleton = bf.getBean( "transient" ).getSingleton();
+ assertTrue( isValid( "component", singleton ), "should return the singleton instance on the 2nd call" );
+ assertTrue( isValid( "component", singleton.getBeanFactory() ), "should return ioc instance on the 2nd call" );
+ }
+
+}
diff --git a/tests/TransientTest.cfc b/tests/TransientTest.cfc
index 3aa12e19..f6613f50 100644
--- a/tests/TransientTest.cfc
+++ b/tests/TransientTest.cfc
@@ -21,4 +21,42 @@ component extends="mxunit.framework.TestCase" {
assertTrue( isObject( product ) );
}
+ function shouldInitializeWithBeans() {
+ variables.factory = new framework.ioc( "/tests/model, /tests/extrabeans",
+ { transients = [ "fish" ], singulars = { sheep = "bean" } } )
+ .addBean( "one", 1 ).addBean( "two", "two" );
+ var i = variables.factory.getBean( "item" );
+ var n1 = application.itemCount;
+ var c = variables.factory.getBean( "construct" );
+ assertEquals( 1, c.getOne() );
+ assertEquals( "two", c.two );
+ assertEquals( n1 + 1, application.itemCount );
+ }
+
+ function shouldInitializeWithConstructorArgs() {
+ variables.factory = new framework.ioc( "/tests/model, /tests/extrabeans",
+ { transients = [ "fish" ], singulars = { sheep = "bean" } } )
+ .addBean( "one", 1 ).addBean( "two", "two" );
+ var i = variables.factory.getBean( "item" );
+ var n1 = application.itemCount;
+ var c = variables.factory.getBean( "construct", { one : "one", two : 2, item : "no-op" } );
+ assertEquals( "one", c.getOne() );
+ assertEquals( 2, c.two );
+ assertEquals( n1, application.itemCount );
+ }
+
+ function shouldInitializeWithOnlyConstructorArgs() {
+ variables.factory = new framework.ioc( "/tests/extrabeans",
+ { singulars = { sheep = "bean" } } );
+ var i = variables.factory.getBean( "item" );
+ var n1 = application.itemCount;
+ var c1 = variables.factory.getBean( "construct", { one : "one", two : 2, item : "no-op" } );
+ assertTrue( isNull( c1.getOne() ) );
+ assertEquals( 2, c1.two );
+ assertEquals( n1, application.itemCount );
+ var c2 = variables.factory.getBean( "construct", { one : 1, two : "two", item : "something" } );
+ assertTrue( isNull( c2.getOne() ) );
+ assertEquals( "two", c2.two );
+ }
+
}
diff --git a/tests/declared/things/myconfig.cfc b/tests/declared/things/myconfig.cfc
index 22341ebb..2e562951 100644
--- a/tests/declared/things/myconfig.cfc
+++ b/tests/declared/things/myconfig.cfc
@@ -1,6 +1,9 @@
component accessors=true {
property string name;
+ property name="dftname" default="default";
+ // not legal syntax: property dftname="default";
+ // legal syntax, doesn't create setter: property string dftname="default";
function init( string data = "none" ) {
setConfig( data );
diff --git a/tests/defaultPropertyTest.cfc b/tests/defaultPropertyTest.cfc
new file mode 100644
index 00000000..f05e0369
--- /dev/null
+++ b/tests/defaultPropertyTest.cfc
@@ -0,0 +1,25 @@
+component extends=mxunit.framework.TestCase {
+
+ function setup() {
+ variables.bf = new framework.ioc( "" )
+ .declare( "default" ).instanceOf( "tests.extrabeans.sheep.default" )
+ .asTransient()
+ .done();
+ }
+
+ function shouldHaveDefaultValue() {
+ var data = {
+ viaNew : new tests.extrabeans.sheep.default(),
+ viaDI1 : variables.bf.getBean( "default" )
+ };
+ assertTrue( isNull( data.viaNew.getSimple() ) );
+ assertTrue( isNull( data.viaNew.getTyped() ) );
+ assertEquals( "Default Value", data.viaNew.getDefaulted() );
+ assertEquals( "Default Type Value", data.viaNew.getDefaultedType() );
+ assertTrue( isNull( data.viaDI1.getSimple() ) );
+ assertTrue( isNull( data.viaDI1.getTyped() ) );
+ assertEquals( "Default Value", data.viaDI1.getDefaulted() );
+ assertEquals( "Default Type Value", data.viaDI1.getDefaultedType() );
+ }
+
+}
diff --git a/tests/extrabeans/sheep/construct.cfc b/tests/extrabeans/sheep/construct.cfc
new file mode 100644
index 00000000..0a09ebcd
--- /dev/null
+++ b/tests/extrabeans/sheep/construct.cfc
@@ -0,0 +1,8 @@
+component accessors=true {
+ property one;
+ function init(two,item) {
+ this.two = two;
+ this.item = item;
+ return this;
+ }
+}
diff --git a/tests/extrabeans/sheep/default.cfc b/tests/extrabeans/sheep/default.cfc
new file mode 100644
index 00000000..92e40e02
--- /dev/null
+++ b/tests/extrabeans/sheep/default.cfc
@@ -0,0 +1,6 @@
+component accessors=true {
+ property simple;
+ property name="typed" type="string";
+ property name="defaulted" default="Default Value";
+ property name="defaultedType" type="string" default="Default Type Value";
+}
diff --git a/tests/frameworkEnvTest.cfc b/tests/frameworkEnvTest.cfc
index 6bb90e5e..10059d6a 100644
--- a/tests/frameworkEnvTest.cfc
+++ b/tests/frameworkEnvTest.cfc
@@ -17,6 +17,10 @@ component extends="tests.InjectableTest" {
};
}
+ public void function testRequestMethod() {
+ assertEquals( CGI.REQUEST_METHOD, variables.fw.getCGIRequestMethod() );
+ }
+
public void function testGetEnvironmentIsCalled() {
variables.fw.getEnvironment = recordCalls;
variables.fwvars.getEnvironment = recordCalls;
diff --git a/tests/frameworkFacadeTest.cfc b/tests/frameworkFacadeTest.cfc
new file mode 100644
index 00000000..954a9828
--- /dev/null
+++ b/tests/frameworkFacadeTest.cfc
@@ -0,0 +1,25 @@
+component extends="mxunit.framework.TestCase" {
+
+ function setup() {
+ structDelete( request, "_fw1" ); // clean up the request
+ }
+
+ function testFacadeOnNonFW1Request() {
+ try {
+ var facade = new framework.facade();
+ fail( "facade creation did not fail" );
+ } catch ( FW1.FacadeException e ) {
+ assertEquals( "Unable to locate FW/1 for this request", e.message );
+ } catch ( any e ) {
+ fail( "caught unexpected exception: " & e.message );
+ }
+ }
+
+ function testFacadeWithFW1() {
+ var fw = new framework.one();
+ fw.onRequestStart( "" );
+ var facade = new framework.facade();
+ assertTrue( structKeyExists( facade, "getBeanFactory" ), "Constructed facade does not look like FW/1" );
+ }
+
+}
diff --git a/tests/frameworkProcessRoutesTest.cfc b/tests/frameworkProcessRoutesTest.cfc
index c470d995..71fef98d 100755
--- a/tests/frameworkProcessRoutesTest.cfc
+++ b/tests/frameworkProcessRoutesTest.cfc
@@ -17,6 +17,7 @@ component extends="tests.InjectableTest" {
{ 'hint' = 'Resource Routes', '$RESOURCES' = 'dogs' }
];
variables.fwVars.framework.routesCaseSensitive = true;
+ variables.fwVars.framework.preflightOptions = true;
}
public void function testProcessRoutes() {
@@ -41,7 +42,7 @@ component extends="tests.InjectableTest" {
assertEquals( '/dogs/update/id/42/', rereplace( routeMatch.path, routeMatch.pattern, routeMatch.target ) );
}
-
+
public void function testProcessRoutesExplicit() {
request._fw1.cgiRequestMethod = 'FOO';
@@ -62,7 +63,35 @@ component extends="tests.InjectableTest" {
assertEquals( '/dogs/update/id/42/', rereplace( routeMatch.path, routeMatch.pattern, routeMatch.target ) );
}
-
+
+ public void function testProcessRoutesOptions() {
+
+ request._fw1.cgiRequestMethod = 'OPTIONS';
+
+ request._fw1.routeMethodsMatched = { };
+ var routeMatch = variables.fw.processRoutes( '/no/match', variables.fw.getRoutes() );
+ assertFalse( routeMatch.matched );
+ assertEquals( { }, request._fw1.routeMethodsMatched );
+
+ request._fw1.routeMethodsMatched = { };
+ routeMatch = variables.fw.processRoutes( '/old/path/foo', variables.fw.getRoutes() );
+ assertFalse( routeMatch.matched );
+ assertEquals( { get : true }, request._fw1.routeMethodsMatched );
+
+ // these show we correctly get methods back based on the ACTUAL route matched
+
+ request._fw1.routeMethodsMatched = { };
+ routeMatch = variables.fw.processRoutes( '/dogs/42', variables.fw.getRoutes() );
+ assertFalse( routeMatch.matched );
+ assertEquals( { get : true, delete : true, patch : true, put : true }, request._fw1.routeMethodsMatched );
+
+ request._fw1.routeMethodsMatched = { };
+ routeMatch = variables.fw.processRoutes( '/dogs', variables.fw.getRoutes() );
+ assertFalse( routeMatch.matched );
+ assertEquals( { get : true, post : true }, request._fw1.routeMethodsMatched );
+
+ }
+
// PRIVATE
private boolean function isFrameworkInitialized() {
diff --git a/tests/frameworkRenderTest.cfc b/tests/frameworkRenderTest.cfc
index ec545e69..f58b858e 100644
--- a/tests/frameworkRenderTest.cfc
+++ b/tests/frameworkRenderTest.cfc
@@ -79,6 +79,40 @@ component extends="mxunit.framework.TestCase" {
assertTrue( output contains "framework lifecycle trace" );
}
+ public void function testNoTraceRenderVarBuilder() {
+ variables.fw.onApplicationStart();
+ variables.fw.renderData( "text" ).data( "test" );
+ var output = "";
+ savecontent variable="output" {
+ variables.fw.onRequestEnd();
+ }
+ assertFalse( output contains "framework lifecycle trace" );
+ }
+
+ public void function testTraceOutputReqBuilder() {
+ request.fw.onApplicationStart();
+ variables.fw.renderData().type( "text" ).data( "myteststring" );
+ var output = "";
+ savecontent variable="output" {
+ request.fw.onRequest("/index.cfm");
+ request.fw.onRequestEnd();
+ }
+ assertTrue( output contains "myteststring" );
+ assertFalse( output contains "framework lifecycle trace" );
+ }
+
+ public void function testTraceOutputHTMLReqBuilder() {
+ request.fw.onApplicationStart();
+ variables.fw.renderData( data = "myteststring
" ).type( "html" );
+ var output = "";
+ savecontent variable="output" {
+ request.fw.onRequest("/index.cfm");
+ request.fw.onRequestEnd();
+ }
+ assertTrue( output contains "myteststring" );
+ assertTrue( output contains "framework lifecycle trace" );
+ }
+
public void function testSetupTraceRenderHtml() {
variables.fwExtended.onApplicationStart();
var output = "";
@@ -98,5 +132,25 @@ component extends="mxunit.framework.TestCase" {
assertEquals( output, "custom trace render" );
}
+ public void function testRenderFunction() {
+ request.fw.onApplicationStart();
+ variables.fw.renderData().type( function( renderData ) {
+ return {
+ contentType = "text/html; charset=utf-8",
+ output = "string",
+ writer = function( out ) {
+ writeOutput( "my written " & out );
+ }
+ };
+ } ).data( "myteststring" );
+ var output = "";
+ savecontent variable="output" {
+ request.fw.onRequest("/index.cfm");
+ request.fw.onRequestEnd();
+ }
+ assertTrue( output contains "my written string" );
+ assertFalse( output contains "framework lifecycle trace" );
+ }
+
}
diff --git a/tests/frameworkRouteTest.cfc b/tests/frameworkRouteTest.cfc
index 63847935..5791c8f6 100644
--- a/tests/frameworkRouteTest.cfc
+++ b/tests/frameworkRouteTest.cfc
@@ -17,6 +17,11 @@ component extends="tests.InjectableTest" {
assertEquals("/test/(.*)", match.pattern);
assertEquals("routed/\1", match.target);
+ match = variables.fw.processRouteMatch("/", "routed", "/test", "GET");
+ assertTrue(match.matched);
+ assertEquals("/(.*)", match.pattern);
+ assertEquals("routed/\1", match.target);
+
match = variables.fw.processRouteMatch("/test2/:id", "default.main?id=:id", "/test2/5", "GET");
assertTrue(match.matched);
assertEquals("/test2/([^/]*)/(.*)", match.pattern);
@@ -87,6 +92,24 @@ component extends="tests.InjectableTest" {
match = variables.fw.processRouteMatch("$POST^/test/:id", "default.main?id=:id", "/foo/test/5", "POST");
assertFalse(match.matched);
+
+ match = variables.fw.processRouteMatch("$*^/test/:id", "default.main?id=:id", "/test/5", "GET");
+ assertTrue(match.matched);
+
+ match = variables.fw.processRouteMatch("$*^/test/:id", "default.main?id=:id", "/test/5", "POST");
+ assertTrue(match.matched);
+
+ match = variables.fw.processRouteMatch("$*^/test/:id", "default.main?id=:id", "/foo/test/5", "GET");
+ assertFalse(match.matched);
+
+ match = variables.fw.processRouteMatch("$*^/test/:id", "default.main?id=:id", "/foo/test/5", "POST");
+ assertFalse(match.matched);
+
+ match = variables.fw.processRouteMatch("$*", "default.error", "/foo/test/5", "GET");
+ assertTrue(match.matched);
+
+ match = variables.fw.processRouteMatch("$*", "default.error", "/foo/test/5", "POST");
+ assertTrue(match.matched);
}
public void function testRouteMatchRedirect()
diff --git a/tests/issue420/singleton.cfc b/tests/issue420/singleton.cfc
new file mode 100644
index 00000000..72d3884a
--- /dev/null
+++ b/tests/issue420/singleton.cfc
@@ -0,0 +1,8 @@
+component accessors="true" {
+
+ property name="beanFactory";
+
+ function init() {
+ return this;
+ }
+}
diff --git a/tests/issue420/transient.cfc b/tests/issue420/transient.cfc
new file mode 100644
index 00000000..3aea6dbf
--- /dev/null
+++ b/tests/issue420/transient.cfc
@@ -0,0 +1,8 @@
+component accessors="true" {
+
+ property name="singleton";
+
+ function init() {
+ return this;
+ }
+}
diff --git a/tests/onMissingViewLayoutTest.cfc b/tests/onMissingViewLayoutTest.cfc
index 3998f95f..c9ef8cb0 100644
--- a/tests/onMissingViewLayoutTest.cfc
+++ b/tests/onMissingViewLayoutTest.cfc
@@ -7,6 +7,7 @@ component extends="tests.InjectableTest" {
variables.fwvars.framework = {
base = "/tests/omv"
};
+ structDelete( request, "layout" );
}
public void function testSetLayout() {
@@ -33,6 +34,24 @@ component extends="tests.InjectableTest" {
assertEquals( "TWOTEST", trim( output ) );
}
+ public void function testCustomRenderer() {
+ var omv = function( rc ) {
+ request.layout = false;
+ return {
+ contentType = "text/html; charset=utf-8",
+ output = "custom output"
+ };
+ };
+ variables.fw.onMissingView = omv;
+ variables.fwvars.onMissingView = omv;
+ variables.fw.onRequestStart( "" );
+ var output = "";
+ savecontent variable="output" {
+ variables.fw.onRequest( "" );
+ }
+ assertEquals( "custom output", trim( output ) );
+ }
+
private string function selectLayoutTwo( struct rc ) {
setLayout( "main.two" );
return view( "main/test" );