Module: Guard::PHPUnit::Runner

Defined in:
lib/guard/phpunit/runner.rb

Overview

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

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

Class Method Details

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

Runs the PHPUnit tests and displays notifications about the results.

Parameters:

  • path (Array<Strings>)

    to the tests files.

  • watchers (Array<Guard::Watcher>)

    the watchers in the Guard block

  • options (Hash) (defaults to: {})

    the options for the Guard

Returns:

  • (Boolean)

    whether the tests were run successfully



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/guard/phpunit/runner.rb', line 28

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

  return false if paths.empty?

  unless phpunit_exists?
    UI.error('phpunit is not installed on your machine.', :reset => true)
    return false
  end

  run_tests(paths, options)
end