Created
June 30, 2012 00:38
-
-
Save cfvonner/3021600 to your computer and use it in GitHub Desktop.
First cut of my Mocking Koan
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
/** | |
* @mxunit:decorators mxunit.framework.decorators.OrderedTestDecorator | |
*/ | |
component extends="Koans.BaseKoan" { | |
public void function beforeTests() { | |
variables.person = createObject( 'component','components.Person' ).init( 'Malcolm','Reynolds',CreateDate(2486,9,20)); | |
} | |
public void function testSaveAsMock() { | |
var mockPersonDAO = mock('Components.PersonDAO','typeSafe'); | |
mockPersonDAO.save(variables.person).returns(true); | |
// I added this because I was getting a different error which I think this solved; | |
// this came from your earlier gist | |
injectProperty(variables.person,'personDAO',mockPersonDAO); | |
variables.person.save(); | |
mockPersonDAO.verify().save(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment