Add grunt phpunit which runs three tasks: phpunit, ajax tests, and phpunit as multisite.

You can also run `grunt phpunit:default`, `grunt phpunit:ajax`, and grunt `phpunit:multisite` separately.

`grunt test` now runs the qunit task (both compiled and uncompiled scripts) and the phpunit tasks.

props bpetty.
fixes #25854, see #25781.


git-svn-id: https://develop.svn.wordpress.org/trunk@26064 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-11-09 21:18:23 +00:00
parent 00dffd1bf8
commit bab82b3b66

View File

@ -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']);