diff --git a/Gruntfile.js b/Gruntfile.js index 4bfe5c3dc7..d2673cbada 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -66,7 +66,7 @@ module.exports = function(grunt) { dest: BUILD_DIR, src: [] }, - 'qunit-compiled': { + qunit: { src: 'tests/qunit/index.html', dest: 'tests/qunit/compiled.html', options: { @@ -159,6 +159,20 @@ module.exports = function(grunt) { qunit: { files: ['tests/qunit/**/*.html'] }, + phpunit: { + default: { + cmd: 'phpunit', + args: ['-c', 'phpunit.xml.dist'] + }, + ajax: { + cmd: 'phpunit', + args: ['-c', 'phpunit.xml.dist', '--group', 'ajax'] + }, + multisite: { + cmd: 'phpunit', + args: ['-c', 'tests/phpunit/multisite.xml'] + } + }, uglify: { core: { expand: true, @@ -260,8 +274,17 @@ module.exports = function(grunt) { 'uglify:tinymce', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce']); // Testing tasks. - grunt.registerTask('test', ['qunit']); - grunt.registerTask('test:compiled', ['build', 'clean:qunit', 'copy:qunit-compiled', 'qunit']); + grunt.registerMultiTask('phpunit', "Runs PHPUnit tests, including the ajax and multisite tests.", function() { + grunt.util.spawn({ + cmd: this.data.cmd, + args: this.data.args, + opts: {stdio: 'inherit'} + }, this.async()); + }); + + grunt.registerTask('qunit:compiled', "Runs QUnit tests on compiled as well as uncompiled scripts.", + ['build', 'copy:qunit', 'qunit', 'clean:qunit']); + grunt.registerTask('test', "Runs all QUnit and PHPUnit tasks.", ['qunit:compiled', 'phpunit']); // Default task. grunt.registerTask('default', ['build']);