mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Build/Test Tools: Use the Composer-installed version of PHPUnit for Grunt tasks.
This makes it easier to run `phpunit` Grunt tasks without having to figure out how and which PHPUnit version needs to be installed. It also more closely matches the `format:php` task. Follow-up to [47881]. Props ocean90. Fixes #53015. git-svn-id: https://develop.svn.wordpress.org/trunk@51016 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cb5a19f8c1
commit
b146e9ae59
28
Gruntfile.js
28
Gruntfile.js
@ -665,31 +665,24 @@ module.exports = function(grunt) {
|
||||
},
|
||||
phpunit: {
|
||||
'default': {
|
||||
cmd: 'phpunit',
|
||||
args: ['--verbose', '-c', 'phpunit.xml.dist']
|
||||
},
|
||||
ajax: {
|
||||
cmd: 'phpunit',
|
||||
args: ['--verbose', '-c', 'phpunit.xml.dist', '--group', 'ajax']
|
||||
},
|
||||
multisite: {
|
||||
cmd: 'phpunit',
|
||||
args: ['--verbose', '-c', 'tests/phpunit/multisite.xml']
|
||||
},
|
||||
'ms-ajax': {
|
||||
cmd: 'phpunit',
|
||||
args: ['--verbose', '-c', 'tests/phpunit/multisite.xml', '--group', 'ajax']
|
||||
},
|
||||
'ms-files': {
|
||||
cmd: 'phpunit',
|
||||
args: ['--verbose', '-c', 'tests/phpunit/multisite.xml', '--group', 'ms-files']
|
||||
},
|
||||
'external-http': {
|
||||
cmd: 'phpunit',
|
||||
args: ['--verbose', '-c', 'phpunit.xml.dist', '--group', 'external-http']
|
||||
},
|
||||
'restapi-jsclient': {
|
||||
cmd: 'phpunit',
|
||||
args: ['--verbose', '-c', 'phpunit.xml.dist', '--group', 'restapi-jsclient']
|
||||
}
|
||||
},
|
||||
@ -1604,24 +1597,31 @@ module.exports = function(grunt) {
|
||||
] );
|
||||
|
||||
// Testing tasks.
|
||||
grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() {
|
||||
grunt.registerMultiTask( 'phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() {
|
||||
var args = phpUnitWatchGroup ? this.data.args.concat( [ '--group', phpUnitWatchGroup ] ) : this.data.args;
|
||||
|
||||
args.unshift( 'test', '--' );
|
||||
|
||||
grunt.util.spawn({
|
||||
cmd: this.data.cmd,
|
||||
args: phpUnitWatchGroup ? this.data.args.concat( [ '--group', phpUnitWatchGroup ] ) : this.data.args,
|
||||
opts: {stdio: 'inherit'}
|
||||
cmd: 'composer',
|
||||
args: args,
|
||||
opts: { stdio: 'inherit' }
|
||||
}, this.async());
|
||||
});
|
||||
|
||||
grunt.registerTask('qunit:compiled', 'Runs QUnit tests on compiled as well as uncompiled scripts.',
|
||||
['build', 'copy:qunit', 'qunit']);
|
||||
grunt.registerTask( 'qunit:compiled', 'Runs QUnit tests on compiled as well as uncompiled scripts.',
|
||||
['build', 'copy:qunit', 'qunit']
|
||||
);
|
||||
|
||||
grunt.registerTask('test', 'Runs all QUnit and PHPUnit tasks.', ['qunit:compiled', 'phpunit']);
|
||||
grunt.registerTask( 'test', 'Runs all QUnit and PHPUnit tasks.', ['qunit:compiled', 'phpunit'] );
|
||||
|
||||
grunt.registerTask( 'format:php', 'Runs the code formatter on changed files.', function() {
|
||||
var done = this.async();
|
||||
var flags = this.flags;
|
||||
var args = changedFiles.php;
|
||||
|
||||
args.unshift( 'format' );
|
||||
|
||||
grunt.util.spawn( {
|
||||
cmd: 'composer',
|
||||
args: args,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user