Add unit test for lifecycle event invocation order

Resolves GitHub issue #15