'Laravel / PHPUnit - Test a forever running command

I have an artisan command that runs forever until canceled explicitly. How can I test that using PHPUnit? Do I need to run it for X amount of time and then kill it and check results? Or is it possible to run the command in the background and check results for x amount of time, and then when the test ends the command gets killed?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source