Skip to content

How to use on windows

Mario Basic edited this page May 22, 2014 · 1 revision

After many attempts I have come to a solution to this.

If you want to run gulp-phpunit from windows, you have to use backslashes and .bat version of phpunit.

PHPUNIT 4.0. does not come with .bat version for some reason. You have to use 4.1. version.**

This is very Laravel specific and is per project and not global, as I have different versions of phpunit for each project.

This is my gulpfile.js for running Laravel tests on Windows 8 64-bit:

var gulp = require('gulp');             // main gulp thingy
var gutil = require('gulp-util');       // stops gulp from stopping on error
var phpunit = require('gulp-phpunit');  // runs phpunit tests

gulp.task('phpunit', function() {
    var options = {debug: false};
    gulp.src('app/tests/*.php')
        .pipe(phpunit(".\\vendor\\bin\\phpunit.bat",options))
        // to use on linux, use: vendor/bin/phpunit
        .on('error', gutil.log);
});

gulp.task('watch', function() {
    gulp.watch('app/**/*.php', ['phpunit']);
})

gulp.task('default', ['phpunit', 'watch']);

I only hope that some poor soul finds this before it is too late... it would have saved me a lot of time.

Clone this wiki locally