Skip to content

Instantly share code, notes, and snippets.

@cfvonner
cfvonner / Person.cfc
Created June 29, 2012 15:20
Sample Components for CFKoans Mocking tests
component displayname="Person" hint="I am a person object." output="false" accessors="true"
{
// Define the properties for this component
property name="personID" type="numeric" getter="true" setter="false" hint="Unique numeric id assigned by the database.";
property name="firstName" type="string" getter="true" setter="true" hint="The first name of the person.";
property name="lastName" type="string" getter="true" setter="true" hint="The last name of the person.";
property name="dateOfBirth" type="date" getter="true" setter="true" hint="The date of birth of the person.";
property name="personDAO" type="Person" getter="false" setter="true";
// Define the functions other than implicit getters and setters for this component
@cfvonner
cfvonner / gist:3018560
Created June 29, 2012 15:18 — forked from bittersweetryan/gist:2919074
Mocking and Stubbing in MXUnit
<cfscript>
//stubbing
public void function testSavingPerson()
output=false hint=""{
//create the mock of your dao
var mockPersonDAO = mock("PersonDAO","typeSafe");
//tell the mock that when save is called with the cut to return void
mockPersonDAO.save(variables.Person).returns();
//add it to the cut
@cfvonner
cfvonner / git_commands
Created April 24, 2012 17:36 — forked from webRat/git_commands
9 Common Git Commands
git init - navigate to the appropriate directory and just type that.
git add . - adds everything in that path
git commit -m 'stuff' - Commits with the message 'stuff'
git branch - views branches
git checkout -b <new branch> - Creates & switches to new branch
git checkout <branch> - switches to branch
git merge <branch> - merges that branch to the existing branch that you're already in.
git branch -d <branch> - deletes branch
git push - This assumes you already have a remote setup (like github)