module Guard::PHPUnit2::Inspector

The Guard::PHPUnit inspector verfies that the changed paths are valid for Guard::PHPUnit.

Attributes

tests_path[RW]

Public Class Methods

clean(paths) click to toggle source

Clean the changed paths and return only valid PHPUnit tests files.

@param [Array<String>] paths the changed paths @return [Array<String>] the valid tests files

# File lib/guard/phpunit2/inspector.rb, line 18
def clean(paths)
  paths.uniq!
  paths.compact!
  paths = paths.select { |p| test_file?(p) }
  clear_tests_files_list
  paths
end

Private Class Methods

clear_tests_files_list() click to toggle source

Clears the list of PHPUnit tests.

@see clean

# File lib/guard/phpunit2/inspector.rb, line 48
def clear_tests_files_list
  @tests_files = nil
end
test_file?(path) click to toggle source

Checks if the paths is a valid test file.

@param [String] path the test path @return [Boolean] whether the path a valid test or not

# File lib/guard/phpunit2/inspector.rb, line 33
def test_file?(path)
  tests_files.include?(path)
end
tests_files() click to toggle source

Scans the tests path and keeps a list of all tests paths.

# File lib/guard/phpunit2/inspector.rb, line 40
def tests_files
  @tests_files ||= Dir.glob( File.join(tests_path, '**', '*Test.php') )
end