Change scope in register function for $app

When running unit tests, the register fails since $this is not in object context