Skip to content

Instantly share code, notes, and snippets.

@carlescliment
Last active August 29, 2015 14:01
Show Gist options
  • Save carlescliment/36d5a791dfd1653b1a7c to your computer and use it in GitHub Desktop.
Save carlescliment/36d5a791dfd1653b1a7c to your computer and use it in GitHub Desktop.
Configuration of watchr for Symfony projects
# Prereqs:
# * Ruby
# * gem install watchr
# Usage:
# copy autounit to php project directory
# run watchr autounit
watch('src/(.*)\.php') do |md|
puts "\e[H\e[2J" #clear console
testpath = md[1].sub(/./) { |s| s.upcase }
if ! /.*Test.php/.match(testpath)
parts = md[1].split('/')
testfile = 'src/' + parts.slice(0,2).join('/') + '/Tests/'+ parts.slice(2, parts.length() - 2).join('/') + 'Test.php'
system("php bin/phpunit -c app #{testfile}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment