Skip to content

Instantly share code, notes, and snippets.

@shostakovich
Created February 13, 2011 13:48
Show Gist options
  • Save shostakovich/824697 to your computer and use it in GitHub Desktop.
Save shostakovich/824697 to your computer and use it in GitHub Desktop.
A simple watch script for symfony
def run_unit_test(file)
system("php5 symfony test:unit #{file}")
end
def run_functional_test(app, controller)
system("php5 symfony test:functional #{app} #{controller}Actions")
end
def build_schema
system("php5 symfony doctrine:build --all-classes")
run_all_tests
end
def run_all_tests
system("php5 symfony test:all")
end
watch( 'lib/(.*)\.class\.php' ) {|m| run_unit_test m[1]}
watch( 'apps/(.*)/modules/(.*)/actions/(.*)\.class\.php' ) {|m| run_functional_test m[1],m[2]}
watch( 'apps/(.*)/modules/(.*)/templates/(.*)\.php' ) {|m| run_functional_test m[1],m[2]}
watch( 'test/functional/(.*)/(.*)ActionsTest\.php' ) {|m| run_functional_test m[1],m[2]}
watch( 'test/unit/(.*)Test\.php' ) {|m| run_unit_test m[1]}
watch( 'config/doctrine/(.*)\.yml' ){ build_schema }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment