Skip to content

Instantly share code, notes, and snippets.

@phcostabh
Last active December 23, 2015 11:18
Show Gist options
  • Save phcostabh/6627103 to your computer and use it in GitHub Desktop.
Save phcostabh/6627103 to your computer and use it in GitHub Desktop.
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