|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Bob\BuildConfig; |
|
4
|
|
|
|
|
5
|
|
|
task('default', ['test', 'phpstan', 'sniff']); |
|
6
|
|
|
|
|
7
|
|
|
desc('Run unit and feature tests'); |
|
8
|
|
|
task('test', ['phpunit', 'behat']); |
|
9
|
|
|
|
|
10
|
|
|
desc('Run unit tests'); |
|
11
|
|
|
task('phpunit', function() { |
|
12
|
|
|
shell('phpunit'); |
|
13
|
|
|
println('Unit tests passed'); |
|
14
|
|
|
}); |
|
15
|
|
|
|
|
16
|
|
|
desc('Run behat feature tests'); |
|
17
|
|
|
task('behat', function() { |
|
18
|
|
|
println('SKIPPED Behat feature tests!!'); |
|
19
|
|
|
#shell('behat --stop-on-failure'); |
|
20
|
|
|
#println('Behat feature tests passed'); |
|
21
|
|
|
}); |
|
22
|
|
|
|
|
23
|
|
|
desc('Run statical analysis using phpstan'); |
|
24
|
|
|
task('phpstan', function() { |
|
25
|
|
|
shell('phpstan analyze src -l 7'); |
|
26
|
|
|
println('Phpstan analysis passed'); |
|
27
|
|
|
}); |
|
28
|
|
|
|
|
29
|
|
|
desc('Run php code sniffer'); |
|
30
|
|
|
task('sniff', function() { |
|
31
|
|
|
shell('phpcs src tests --standard=PSR2'); |
|
32
|
|
|
println('Syntax checker passed'); |
|
33
|
|
|
}); |
|
34
|
|
|
|
|
35
|
|
|
desc('Globally install development tools'); |
|
36
|
|
|
task('install_dev_tools', function() { |
|
37
|
|
|
shell('composer global require consolidation/cgr'); |
|
38
|
|
|
shell('cgr phpunit/phpunit'); |
|
39
|
|
|
shell('cgr behat/behat'); |
|
40
|
|
|
shell('cgr phpstan/phpstan'); |
|
41
|
|
|
shell('cgr squizlabs/php_codesniffer'); |
|
42
|
|
|
}); |
|
43
|
|
|
|
|
44
|
|
|
function shell(string $command) |
|
45
|
|
|
{ |
|
46
|
|
|
return sh($command, null, ['failOnError' => true]); |
|
47
|
|
|
} |
|
48
|
|
|
|