class Guard::PHPUnit2::RealtimeRunner

The Guard::PHPUnit runner handles running the tests, displaying their output and notifying the user about the results.

Public Class Methods

run(paths, options) click to toggle source
# File lib/guard/phpunit2/realtime_runner.rb, line 12
def self.run(paths, options)
  self.new.run(paths, options)
end

Protected Instance Methods

execute_command(command) click to toggle source

Executes a system command but does not return the output

@param [String] command the command to be run

# File lib/guard/phpunit2/realtime_runner.rb, line 38
def execute_command(command)
  system(command)
end
execute_phpunit(tests_folder, options) click to toggle source
# File lib/guard/phpunit2/realtime_runner.rb, line 42
def execute_phpunit(tests_folder, options)
  require 'tempfile'
  log_file = Tempfile.new "guard-phpunit2"
  execute_command(phpunit_command(tests_folder, options, log_file.path))

  log = log_file.read
  log_file.close
  log_file.unlink

  log
end
parse_output(log) click to toggle source
# File lib/guard/phpunit2/realtime_runner.rb, line 18
def parse_output(log)
  LogReader.parse_output(log)
end
phpunit_command(path, options, logfile) click to toggle source

Generates the phpunit command for the tests paths.

@param (see run) @param (see run) @see run_tests

Calls superclass method
# File lib/guard/phpunit2/realtime_runner.rb, line 28
def phpunit_command(path, options, logfile)
  super(path, options) do |cmd_parts|
    cmd_parts << "--log-json #{logfile}"
  end
end