guard-phpunit 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/guard/phpunit.rb +4 -2
- data/lib/guard/phpunit/formatter.rb +5 -5
- data/lib/guard/phpunit/runner.rb +11 -11
- data/lib/guard/phpunit/version.rb +1 -1
- metadata +23 -20
data/lib/guard/phpunit.rb
CHANGED
@@ -3,7 +3,7 @@ require 'guard/guard'
|
|
3
3
|
|
4
4
|
module Guard
|
5
5
|
|
6
|
-
# The PHPUnit guard gets notified about system
|
6
|
+
# The PHPUnit guard gets notified about system
|
7
7
|
# events.
|
8
8
|
#
|
9
9
|
class PHPUnit < Guard
|
@@ -26,6 +26,8 @@ module Guard
|
|
26
26
|
# @param [Array<Guard::Watcher>] watchers the watchers in the Guard block
|
27
27
|
# @param [Hash] options the options for the Guard
|
28
28
|
# @option options [Boolean] :all_on_start run all tests on start
|
29
|
+
# @option options [Boolean] :all_after_pass run all tests after failed tests pass
|
30
|
+
# @option options [Boolean] :keep_failed remember failed tests or not
|
29
31
|
# @option options [String] :cli The CLI arguments passed to phpunit
|
30
32
|
# @option options [String] :tests_path the path where all tests exist
|
31
33
|
#
|
@@ -89,7 +91,7 @@ module Guard
|
|
89
91
|
if tests_passed
|
90
92
|
@failed_paths -= paths
|
91
93
|
else
|
92
|
-
@failed_paths += paths
|
94
|
+
@failed_paths += paths
|
93
95
|
end
|
94
96
|
end
|
95
97
|
|
@@ -3,7 +3,7 @@ module Guard
|
|
3
3
|
|
4
4
|
# The Guard::PHPUnit formatter parses the output
|
5
5
|
# of phpunit which gets printed by the progress
|
6
|
-
# printer.
|
6
|
+
# printer.
|
7
7
|
#
|
8
8
|
module Formatter
|
9
9
|
class << self
|
@@ -31,16 +31,16 @@ module Guard
|
|
31
31
|
#
|
32
32
|
# @param [String, Array<String>] string_list the words
|
33
33
|
# @param [String] text the tests output
|
34
|
-
# @return [Integer] the total number assigned to the words
|
34
|
+
# @return [Integer] the total number assigned to the words
|
35
35
|
#
|
36
36
|
def look_for_words_in(strings_list, text)
|
37
37
|
count = 0
|
38
38
|
strings_list = Array(strings_list)
|
39
39
|
strings_list.each do |s|
|
40
40
|
text =~ %r{
|
41
|
-
(\d+) # count of what we are looking for
|
41
|
+
(\d+) # count of what we are looking for
|
42
42
|
[ ] # then a space
|
43
|
-
#{s}s? # then the string
|
43
|
+
#{s}s? # then the string
|
44
44
|
.* # then whatever
|
45
45
|
\Z # start looking at the end of the text
|
46
46
|
}x
|
@@ -53,7 +53,7 @@ module Guard
|
|
53
53
|
#
|
54
54
|
# @param [String] text the tests output
|
55
55
|
# @return [Integer] the duration
|
56
|
-
#
|
56
|
+
#
|
57
57
|
def look_for_duration_in(text)
|
58
58
|
text =~ %r{Finished in (\d)+ seconds?.*\Z}m
|
59
59
|
$1.nil? ? 0 : $1.to_i
|
data/lib/guard/phpunit/runner.rb
CHANGED
@@ -10,7 +10,7 @@ module Guard
|
|
10
10
|
module Runner
|
11
11
|
class << self
|
12
12
|
|
13
|
-
# The exittcode phpunit returns when the tests contain failures
|
13
|
+
# The exittcode phpunit returns when the tests contain failures
|
14
14
|
#
|
15
15
|
PHPUNIT_FAILURES_EXITCODE = 1
|
16
16
|
|
@@ -22,14 +22,14 @@ module Guard
|
|
22
22
|
# about the results.
|
23
23
|
#
|
24
24
|
# @param [Array<Strings>] path to the tests files.
|
25
|
-
# @param (see PHPUnit#initialize)
|
25
|
+
# @param (see PHPUnit#initialize)
|
26
26
|
# @return [Boolean] whether the tests were run successfully
|
27
27
|
#
|
28
28
|
def run(paths, options = {})
|
29
29
|
paths = Array(paths)
|
30
|
-
|
30
|
+
|
31
31
|
return false if paths.empty?
|
32
|
-
|
32
|
+
|
33
33
|
unless phpunit_exists?
|
34
34
|
UI.error('phpunit is not installed on your machine.', :reset => true)
|
35
35
|
return false
|
@@ -46,10 +46,10 @@ module Guard
|
|
46
46
|
# @return [Boolean] The status of phpunit
|
47
47
|
#
|
48
48
|
def phpunit_exists?
|
49
|
-
system('
|
49
|
+
system('hash', 'phpunit')
|
50
50
|
end
|
51
51
|
|
52
|
-
# Executes the testing command on the tests
|
52
|
+
# Executes the testing command on the tests
|
53
53
|
# and returns the status of this process.
|
54
54
|
#
|
55
55
|
# @param (see #run)
|
@@ -77,7 +77,7 @@ module Guard
|
|
77
77
|
if $?.success? or tests_contain_failures? or tests_contain_errors?
|
78
78
|
notify_results(output, options)
|
79
79
|
else
|
80
|
-
notify_failure(options)
|
80
|
+
notify_failure(options)
|
81
81
|
end
|
82
82
|
|
83
83
|
$?.success?
|
@@ -112,7 +112,7 @@ module Guard
|
|
112
112
|
return if options[:notification] == false
|
113
113
|
Notifier.notify('Failed! Check the console', :title => 'PHPUnit results', :image => :failed)
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
# Checks the exitstatus of the phpunit command
|
117
117
|
# for a sign of failures in the tests.
|
118
118
|
#
|
@@ -146,7 +146,7 @@ module Guard
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
-
# Creates symbolic links inside the folder pointing
|
149
|
+
# Creates symbolic links inside the folder pointing
|
150
150
|
# back to the paths.
|
151
151
|
#
|
152
152
|
# @see #create_tests_folder_for
|
@@ -162,11 +162,11 @@ module Guard
|
|
162
162
|
end
|
163
163
|
|
164
164
|
# Generates the phpunit command for the tests paths.
|
165
|
-
#
|
165
|
+
#
|
166
166
|
# @param (see #run)
|
167
167
|
# @param (see #run)
|
168
168
|
# @see #run_tests
|
169
|
-
#
|
169
|
+
#
|
170
170
|
def phpunit_command(path, options)
|
171
171
|
formatter_path = File.join( File.dirname(__FILE__), 'formatters', 'PHPUnit-Progress')
|
172
172
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-phpunit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,74 +9,74 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
16
|
-
requirement: &
|
16
|
+
requirement: &20091820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.10.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *20091820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &20089560 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 1.0.21
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *20089560
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &20087380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 2.7.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *20087380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: guard-rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &20085400 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.6.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *20085400
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: yard
|
60
|
-
requirement: &
|
60
|
+
requirement: &20100140 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
65
|
+
version: 0.7.4
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *20100140
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: redcarpet
|
71
|
-
requirement: &
|
71
|
+
requirement: &20098520 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 2.0.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *20098520
|
80
80
|
description: Guard::PHPUnit automatically run your unit-tests written with the PHPUnit
|
81
81
|
testing framework.
|
82
82
|
email:
|
@@ -107,6 +107,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
hash: 2842828956755801969
|
110
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
114
|
none: false
|
112
115
|
requirements:
|