Skip to content

Commit

Permalink
Add a third test with "bookended" args
Browse files Browse the repository at this point in the history
Just testing the case where there's a bean, no bean and then bean
again to make sure that the fix hasn't introduced any issues
in that case.
  • Loading branch information
Marcin Szczepanski committed Apr 6, 2013
1 parent 1022416 commit a0feaf5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/defaultarg.cfc
Expand Up @@ -11,4 +11,18 @@ component extends="mxunit.framework.TestCase" {
assertEquals( 0, user37b.getID() ); assertEquals( 0, user37b.getID() );
} }


function checkDefaultInitArgThreeArgs() {
var factory = new ioc( "/tests/model", { constants = { dsn = "sample" } } );
var user37c = factory.getBean( "user37c" );
assertEquals( "sample", user37c.getDSN() );
assertEquals( 0, user37c.getID() );
assertEquals( "Bob", user37c.getName() );

factory = new ioc( "/tests/model", { constants = { dsn = "sample", name="John" } } );
user37c = factory.getBean( "user37c" );
assertEquals( "sample", user37c.getDSN() );
assertEquals( 0, user37c.getID() );
assertEquals( "John", user37c.getName() );

}
} }
13 changes: 13 additions & 0 deletions tests/model/beans/user37c.cfc
@@ -0,0 +1,13 @@
component accessors="true" {
property name="DSN";
property name="ID";
property name="name";

// to reveal an ordering bug changed ID to cd just so it comes before dsn
public any function init( dsn, ID = 0, NAME = "Bob") {
variables.dsn = dsn;
variables.ID = ID;
variables.name = name;
return this;
}
}

0 comments on commit a0feaf5

Please sign in to comment.