Last active
December 23, 2015 11:18
-
-
Save phcostabh/6627103 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src = "#{ARGV[1]}.*.php" | |
tests = src.gsub("src/", "tests/Unit/") | |
watch(src) do |match| | |
match[0].gsub!("src/", "") | |
run_test %{tests/Unit/#{match[0]}} | |
end | |
watch(tests) do |match| | |
run_test match[0] | |
end | |
def run_test file | |
unless File.exist? file | |
puts "#{file} does not exist" | |
return | |
end | |
puts "Running #{file}" | |
result = `./vendor/bin/phpunit #{file}` | |
clear_console | |
puts result | |
end | |
def clear_console | |
puts "\e[H\e[2J" #clear console | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment