Background task refactor and using PHPUnit asserts