forked from braintree/braintree_php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
53 lines (42 loc) · 1.3 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
task :default => :test
task :test => %w[test:unit test:integration]
namespace :test do
desc "print PHP version"
task :version do
print_php_version("php")
end
desc "run unit tests under PHP"
task :unit => :version do
run_php_test_suite("php", "unit")
end
desc "run integration tests under PHP"
task :integration do
run_php_test_suite("php", "integration")
end
desc "run tests under PHP"
task :php => %w[php:unit php:integration]
desc "run a single test file"
task :file, :file_path do |t, args|
run_php_test_file(args[:file_path])
end
desc "run single test (e.g. rake test:single[GatewayTest::testConfigGetsAssertedValid])"
task :single, :test_name do |t, args|
run_php_test(args[:test_name])
end
end
desc "update the copyright year"
task :copyright, :from_year, :to_year do |t, args|
sh "find tests lib -type f -name '*.php' -exec sed -i 's/#{args[:from_year]} Braintree/#{args[:to_year]} Braintree/g' {} +"
end
def print_php_version(interpreter)
sh "#{interpreter} --version"
end
def run_php_test_suite(interpreter, test_suite)
sh "#{interpreter} ./vendor/bin/phpunit --testsuite #{test_suite}"
end
def run_php_test_file(test_file)
sh "./vendor/bin/phpunit #{test_file}"
end
def run_php_test(test_name)
sh "./vendor/bin/phpunit --filter #{test_name}"
end