Changeset 2280 for coldbox/trunk/system/testing/BaseTestCase.cfc
- Timestamp:
- 05/21/09 00:53:49 (4 years ago)
- Files:
-
- 1 modified
-
coldbox/trunk/system/testing/BaseTestCase.cfc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
coldbox/trunk/system/testing/BaseTestCase.cfc
r2257 r2280 24 24 of the Application Start Handler to be executed. 25 25 26 <cfscript> 27 people = querySim(' 28 id , name , mail 29 1 | weed | weed@theflowerpot.not 30 2 | bill | bill@theflowerpot.not 31 3 | ben | ben@theflowerpot.not 32 '); 33 </cfscript> 34 26 35 ----------------------------------------------------------------------> 27 36 <cfcomponent name="BaseTestCase" 28 37 extends="mxunit.framework.TestCase" 29 38 output="false" 30 hint="A base unit test case for MXUnit">39 hint="A base unit test case for doing ColdBox Testing"> 31 40 32 41 <!------------------------------------------- CONSTRUCTOR -------------------------------------------> … … 39 48 instance.configMapping = ""; 40 49 instance.controller = 0; 50 instance.coldboxAppKey = "cbController"; 41 51 42 52 /* Public Properties */ … … 59 69 if( this.loadColdbox ){ 60 70 /* Check on Scope Firsty */ 61 if( structKeyExists(application, "cbController") ){62 instance.controller = application .cbController;71 if( structKeyExists(application,getColdboxAppKey()) ){ 72 instance.controller = application[getColdboxAppKey()]; 63 73 } 64 74 else{ … … 67 77 /* Verify Persistence */ 68 78 if( this.persist_framework ){ 69 application .cbController= instance.controller;79 application[getColdboxAppKey()] = instance.controller; 70 80 } 71 81 /* Setup */ … … 99 109 <cfset structDelete(application,"cbController")> 100 110 </cffunction> 101 111 112 <!--- get/Set Coldbox App Key ---> 113 <cffunction name="getcoldboxAppKey" access="public" output="false" returntype="string" hint="Get the coldboxAppKey"> 114 <cfreturn instance.coldboxAppKey/> 115 </cffunction> 116 <cffunction name="setcoldboxAppKey" access="public" output="false" returntype="void" hint="Override the coldboxAppKey"> 117 <cfargument name="coldboxAppKey" type="string" required="true"/> 118 <cfset instance.coldboxAppKey = arguments.coldboxAppKey/> 119 </cffunction> 120 102 121 <!--- getter for AppMapping ---> 103 122 <cffunction name="getAppMapping" access="private" returntype="string" output="false" hint="Get the AppMapping"> … … 210 229 <cfabort> 211 230 </cffunction> 231 232 <cfscript> 233 /** 234 * Accepts a specifically formatted chunk of text, and returns it as a query object. 235 * v2 rewrite by Jamie Jackson 236 * 237 * @param queryData Specifically format chunk of text to convert to a query. (Required) 238 * @return Returns a query object. 239 * @author Bert Dawson (bert@redbanner.com) 240 * @version 2, December 18, 2007 241 * 242 */ 243 function querySim(queryData) { 244 var fieldsDelimiter="|"; 245 var colnamesDelimiter=","; 246 var listOfColumns=""; 247 var tmpQuery=""; 248 var numLines=""; 249 var cellValue=""; 250 var cellValues=""; 251 var colName=""; 252 var lineDelimiter=chr(10) & chr(13); 253 var lineNum=0; 254 var colPosition=0; 255 256 // the first line is the column list, eg "column1,column2,column3" 257 listOfColumns = Trim(ListGetAt(queryData, 1, lineDelimiter)); 258 259 // create a temporary Query 260 tmpQuery = QueryNew(listOfColumns); 261 262 // the number of lines in the queryData 263 numLines = ListLen(queryData, lineDelimiter); 264 265 // loop though the queryData starting at the second line 266 for(lineNum=2; lineNum LTE numLines; lineNum = lineNum + 1) { 267 cellValues = ListGetAt(queryData, lineNum, lineDelimiter); 268 269 if (ListLen(cellValues, fieldsDelimiter) IS ListLen(listOfColumns,",")) { 270 QueryAddRow(tmpQuery); 271 for (colPosition=1; colPosition LTE ListLen(listOfColumns); colPosition = colPosition + 1){ 272 cellValue = Trim(ListGetAt(cellValues, colPosition, fieldsDelimiter)); 273 colName = Trim(ListGetAt(listOfColumns,colPosition)); 274 QuerySetCell(tmpQuery, colName, cellValue); 275 } 276 } 277 } 278 279 return( tmpQuery ); 280 281 } 282 </cfscript> 212 283 213 284 </cfcomponent>
