Skip to content

Instantly share code, notes, and snippets.

@banksy89
Last active December 13, 2015 19:09
Show Gist options
  • Save banksy89/4960692 to your computer and use it in GitHub Desktop.
Save banksy89/4960692 to your computer and use it in GitHub Desktop.
Rake file for calling all PHPUnit unit tests within a directory
# setting the path of Admin suite unit tests
admin_units = "admin/tests/units"
desc "Testing all admin unit tests"
task :admin_units do
puts "Going to test all unit tests now....hold tight...."
tests = Dir.entries(admin_units)
tests.each do |file|
if file != '.' && file != '..'
units = Dir.entries("#{admin_units}/#{file}")
units.each do |unit|
if unit != '.' && unit != '..'
puts "Running Unit Test: #{admin_units}/#{file}/#{unit}......"
# adding colours to the terminal
system("phpunit --colors --verbose #{admin_units}/#{file}/#{unit}")
end
end
end
end
end
task :default => ["admin_units"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment