Skip to content

Instantly share code, notes, and snippets.

@thelinuxlich
Created August 31, 2012 17:42
Show Gist options
  • Save thelinuxlich/3556356 to your computer and use it in GitHub Desktop.
Save thelinuxlich/3556356 to your computer and use it in GitHub Desktop.
Using Guard to automate laravel artisan test task
guard 'sass', :input=> 'public/sass', :output => 'public/css', :style => :compressed
guard 'coffeescript', :input => 'public/coffee', :output => 'public/js',:bare => true
module ::Guard
class ArtisanTest < Guard
def run_on_change(paths)
::Guard::UI.info("Running tests...")
::Guard::Notifier.notify("Running tests...",:title => "Laravel",:image => :pending)
output = `php artisan test`
if output =~ /FAILURE/
::Guard::Notifier.notify("Some tests failed!",:title => "Laravel",:image => :failed)
else
::Guard::Notifier.notify("All tests succeeded!",:title => "Laravel",:image => :success)
end
end
end
end
guard 'artisan-test' do
watch('(.+)\.php$')
end
@villimagg
Copy link

Would it be simpler to use guard-phpunit? And if so how would you do it?

Hope you can help me with this?
Thanks.
VilliMagg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment