Add tests for hook_before_rotate, hook_after_rotate