Module: Guard::PHPUnit2::LogReader
- Defined in:
- lib/guard/phpunit2/logreader.rb
Class Method Summary collapse
-
.parse_output(output) ⇒ Hash
Parses the output of –log-json.
Class Method Details
.parse_output(output) ⇒ Hash
Parses the output of –log-json
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/guard/phpunit2/logreader.rb', line 18 def parse_output(output) log = JSON.parse(clean_output(output)) tests = 0 passes = 0 errors = 0 failures = 0 skips = 0 duration = 0 tests = log.first['tests'] unless log.empty? log.each do |event| passes += 1 if passed_test?(event) failures += 1 if failed_test?(event) skips += 1 if skipped_test?(event) errors += 1 if error_test?(event) duration += event['time'] if event['time'] end { :tests => tests, :failures => failures, :errors => errors, :pending => skips, :duration => calculate_duration(duration) } end |