How do I test a command-line program with PHPUnit? I see plenty of help for using PHPUnit from the command line, but none for testing a command-line program itself with PHPUnit.
This comes up because I am writing command-line programs in PHP and Joomla, but don't see a way to test their output, especially when errors occur (because you cannot test error output using PHPUnit's expectOutputString()).
(EDIT: Note that the bulk of my code is already in classes which are tested by PHPUnit -- I'm looking for a way to test the command-line (wrapper) program's logic.)
See Question&Answers more detail:os