Test refactor: encapsulate test setup and cleanup, remove confusing provider variable.