This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfcomponent extends="mxunit.framework.TestCase" | |
mxunit:decorators=mxunit.framework.decorators.OrderedTestDecorator> | |
... | |
</cfcomponent> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> //ignore, just here to get syntax coloring | |
/** | |
*@order 1 | |
*/ | |
public void function testIfVariableExists() { | |
assertEquals(isDefined("someVariableWithALongName") ,"__"); | |
} | |
/** | |
*@order 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="testIsQuery" returntype="void" output="false" order="1"> | |
<cfset var myQry = buildQueryObj()> | |
<!--- Check that a variable is a query ---> | |
<cfset assertEquals(IsQuery(myQry),"___")> | |
</cffunction> | |
<cffunction name="testGettingQueryRecordCount" returntype="void" output="false" order="2"> | |
<cfset var myQry = buildQueryObj()> | |
<!--- The total number of records in a returned query can be accessed using the recordcount ---> | |
<cfset assertEquals(myQry.recordCount,"___")> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
if(var1 AND var2){ resultingVar = true;}else{ resultingVar = false;} | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
anotherVar = (var1 AND var2) ? true : false ; //cf9+ only | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
anotherVar = var1 && var2; //cf9+anotherVar = var1 AND var2; //cf8- | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript>//only for coloring | |
/** | |
* @mxunit:decorators mxunit.framework.decorators.TransactionRollbackDecorator | |
*/ | |
component extends="mxunit.framework.TestCase" hint=""{ | |
. | |
. | |
public void testSomething(){ | |
//add,update,delete database | |
assertEquals(); //or any other assertion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void function testAuthenticatingUserWithWrongPassword(){ | |
createUser(); | |
user.setPassword("iLoveBieber"); | |
assertTrue(user.authenticate()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
public Array function map(Array arr,Function fn) | |
output=false { | |
//this is the new array that will hold the results | |
//of applying the function to each element of the array | |
var ret = []; | |
//use the new for-in construct to loop through each | |
//item in the array | |
for(ele in arr){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User = Backbone.Model.extend({ | |
defaults: function(){ | |
return{ | |
"contact.firstName" : "", | |
"contact.lastName" : "" | |
}; | |
}, | |
url: "user" | |
}); |