diff --git a/lib/guard/phpunit/runner.rb b/lib/guard/phpunit/runner.rb index fa3e617..f37a884 100644 --- a/lib/guard/phpunit/runner.rb +++ b/lib/guard/phpunit/runner.rb @@ -77,13 +77,16 @@ def run_tests(paths, options) # return false in case the system call fails with no status! return false if $?.nil? - if $?.success? or tests_contain_failures? or tests_contain_errors? + # capture success so that if notifications alter the status stored in $? we still return the correct value + success = $?.success? + + if success or tests_contain_failures? or tests_contain_errors? notify_results(output, options) else notify_failure(options) end - $?.success? + success end # Displays the start testing notification. @@ -194,4 +197,4 @@ def execute_command(command) end end end -end \ No newline at end of file +end