Skip to content

Instantly share code, notes, and snippets.

@roryl
Last active June 6, 2016 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roryl/c8c33b03651b5c4641a4a711799db735 to your computer and use it in GitHub Desktop.
Save roryl/c8c33b03651b5c4641a4a711799db735 to your computer and use it in GitHub Desktop.
Lucee Implicit Method Examples
component {
this.triggerDataMember=true;
}
component {
public function init(){
}
public function setMyValue(string){
this.myValue = ucase(arguments.string);
}
public function getMyValue(){
return this.myValue;
}
}
<cfscript>
myObj = new basicComponent();
myObj.setMyValue("foo");
echo(myObj.getMyValue());
</cfscript>
<cfscript>
myObj = new basicComponent();
myObj.MyValue = "foo";
echo(myObj.MyValue); //Outputs FOO
</cfscript>
/**
* My xUnit Test
*/
component extends="testbox.system.BaseSpec"{
/*********************************** LIFE CYCLE Methods ***********************************/
// executes before all test cases
function beforeTests(){
}
// executes after all test cases
function afterTests(){
}
// executes before every test case
function setup( currentMethod ){
}
// executes after every test case
function teardown( currentMethod ){
}
/*********************************** TEST CASES BELOW ***********************************/
// Remember that test cases MUST start or end with the keyword 'test'
function checkAllSyntaxTest(){
var files = directoryList("");
for(file IN files){
if(file CONTAINS ".cfm" AND !file CONTAINS "use_validations"){
include template="#getFileFromPath(file)#";
}
}
}
}
<cfscript>
myObj = new basicComponent();
myObj.myValue = "foo";
writeDump(myObj.myValue);
myObj.setMyValue("bar");
writeDump(myObj.myValue);
myObj.otherVar = "baz";
writeDump(myObj.otherVar);
writeDump(myObj);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment