Cleanup resets the test application state and removes the test app's dataDir from the filesystem. After this call, the app instance shouldn't be used anymore.
()
| 33 | // |
| 34 | // After this call, the app instance shouldn't be used anymore. |
| 35 | func (t *TestApp) Cleanup() { |
| 36 | event := new(core.TerminateEvent) |
| 37 | event.App = t |
| 38 | |
| 39 | t.OnTerminate().Trigger(event, func(e *core.TerminateEvent) error { |
| 40 | t.TestMailer.Reset() |
| 41 | t.ResetEventCalls() |
| 42 | t.ResetBootstrapState() |
| 43 | |
| 44 | return e.Next() |
| 45 | }) |
| 46 | |
| 47 | if t.DataDir() != "" { |
| 48 | os.RemoveAll(t.DataDir()) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // ResetEventCalls resets the EventCalls counter. |
| 53 | func (t *TestApp) ResetEventCalls() { |