Permalink
Browse files

Add a third test with "bookended" args

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...
1 parent 1022416 commit a0feaf5d3e7c28a29f732086e8ebfc5fbda0dfde @marcins committed Apr 6, 2013
Showing with 27 additions and 0 deletions.
  1. +14 −0 tests/defaultarg.cfc
  2. +13 −0 tests/model/beans/user37c.cfc
View
@@ -11,4 +11,18 @@ component extends="mxunit.framework.TestCase" {
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() );
+
+ }
}
@@ -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.