Search code examples
actionscript-3asmock

Is replay() and replayAll() necessary for asmock?


looking at asmock examples (http://asmock.sourceforge.net/wiki/Quick_Start_Guide) i noticed that whenever the setup of the mock is complete (settings of returnValue etc) replay or replayall is called. I am not sure of what is the purpose of calling them and is it mandatory. can someone clarify this ?

Thanks


Solution

  • When mocks are first created they are placed into "record" mode, whereby method calls don't do anything but can be programmed to act as is required. In order to use the mock as it has been configured, it needs to change to "replay" mode. replayAll simply changes all mocks created by that repository into replay mode with one call.