Class: Guard::PHPUnit2::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/phpunit2/runner.rb

Overview

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

Direct Known Subclasses

RealtimeRunner

Constant Summary collapse

PHPUNIT_FAILURES_EXITCODE =

The exittcode phpunit returns when the tests contain failures

1
PHPUNIT_ERRORS_EXITCODE =

The exittcode phpunit returns when the tests contain errors

2

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(paths, options) ⇒ Object



12
13
14
# File 'lib/guard/phpunit2/runner.rb', line 12

def self.run(paths, options)
  self.new.run(paths, options)
end

Instance Method Details

#run(paths, options = {}) ⇒ Boolean

Runs the PHPUnit tests and displays notifications about the results.

Parameters:

  • path (Array<Strings>)

    to the tests files.

Returns:

  • (Boolean)

    whether the tests were run successfully



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/guard/phpunit2/runner.rb', line 31

def run(paths, options = {})
  paths = Array(paths)

  return false if paths.empty?

  unless phpunit_exists?(options)
    UI.error('the provided php unit command is invalid or phpunit is not installed on your machine.', :reset => true)
    return false
  end

  run_tests(paths, options)
end