Class: Guard::PHPUnit2
- Defined in:
- lib/guard/phpunit2.rb,
lib/guard/phpunit2/runner.rb,
lib/guard/phpunit2/notifier.rb,
lib/guard/phpunit2/formatter.rb,
lib/guard/phpunit2/inspector.rb
Overview
The PHPUnit guard gets notified about system events.
Defined Under Namespace
Modules: Formatter, Inspector, Notifier, Runner
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :all_on_start => true, :all_after_pass => true, :keep_failed => true, :cli => nil, :tests_path => Dir.pwd, :notification => true }
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ PHPUnit2
constructor
Initialize Guard::PHPUnit.
-
#run_all ⇒ Object
Gets called when all tests should be run.
-
#run_on_changes(paths) ⇒ Object
Gets called when the watched tests have changes.
-
#start ⇒ Object
Gets called once when Guard starts.
Constructor Details
#initialize(watchers = [], options = {}) ⇒ PHPUnit2
Initialize Guard::PHPUnit.
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/guard/phpunit2.rb', line 36 def initialize(watchers = [], = {}) defaults = DEFAULT_OPTIONS.clone @options = defaults.merge() super(watchers, @options) @failed_paths = [] @previous_failed = false Inspector.tests_path = @options[:tests_path] end |
Instance Method Details
#run_all ⇒ Object
Gets called when all tests should be run.
59 60 61 62 63 64 65 66 |
# File 'lib/guard/phpunit2.rb', line 59 def run_all success = Runner.run([:tests_path], .merge( :message => 'Running all tests' )) @previous_failed = !success throw :task_has_failed unless success end |
#run_on_changes(paths) ⇒ Object
Gets called when the watched tests have changes.
73 74 75 76 77 78 79 80 |
# File 'lib/guard/phpunit2.rb', line 73 def run_on_changes(paths) paths = Inspector.clean(paths + @failed_paths) success = Runner.run(paths, ) update_failed_paths(success, paths) run_all_after_pass(success) throw :task_has_failed unless success end |
#start ⇒ Object
Gets called once when Guard starts.
51 52 53 |
# File 'lib/guard/phpunit2.rb', line 51 def start run_all if [:all_on_start] end |