I'm trying to capture the output of my test suite from PHPUnit to determine whether a failure occurred. However, when I attempt to store the output in a bash variable, the variable is always empty:
if [ -z "$PHPUNIT_RESULT" ]; then
echo "something there!
PHPUnit 3.4.5 by Sebastian Bergmann.
Time: 0 seconds, Memory: 8.00Mb
There was 1 failure:
Failed asserting that <boolean:false> is true.
Tests: 4, Assertions: 5, Failures: 1, Incomplete: 1.
if there's any test failure, phpunit will exit with a non-zero status. you can check this with the
./vendor/bin/phpunit /path/to/myTest.php if [ $? -ne 0 ]; then echo "failed test" fi