Created
October 8, 2014 16:39
-
-
Save acavanagh/7ba1ee5724bdbeb45525 to your computer and use it in GitHub Desktop.
Gulp file to run phpunit and behat tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//gulpfile.js | |
var gulp = require('gulp'); | |
var beep = require('beepbeep'); | |
var sys = require('sys'); | |
var exec = require('child_process').exec; | |
var gutil = require('gulp-util'); | |
var plumber = require('gulp-plumber'); | |
var onError = function(err) { | |
beep([1000, 1000, 1000]); | |
gutil.log(gutil.colors.red(err)); | |
} | |
var onSuccess = function(message) { | |
gutil.log(gutil.colors.green(message)); | |
} | |
// Run all PHPUnit tests | |
gulp.task('phpunit', function() { | |
exec('phpunit tests/BehatEditor/Tests/ProjectServicesTest.php', function(error, stdout) { | |
if(error !== null) | |
{ | |
onError(stdout); | |
} | |
else | |
{ | |
onSuccess(stdout); | |
} | |
}); | |
exec('phpunit tests/BehatEditor/Tests/BehatTestServiceTest.php', function(error, stdout) { | |
if(error !== null) | |
{ | |
onError(stdout); | |
} | |
else | |
{ | |
onSuccess(stdout); | |
} | |
}); | |
}); | |
gulp.task('behat', function() { | |
exec('bin/behat --config=tests/behat/behat.yml tests/behat/features/api/tests_api.feature', function(error, stdout) { | |
if(error !== null) | |
{ | |
onError(stdout); | |
} | |
else | |
{ | |
onSuccess(stdout); | |
} | |
}); | |
}); | |
gulp.task('watch', function () { | |
gulp.watch('app/**/*.php', ['phpunit', 'behat']); | |
gulp.watch('tests/BehatEditor/Tests/*', ['phpunit']); | |
gulp.watch('tests/behat/features/*', ['phpunit']); | |
}); | |
gulp.task('default', ['watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment