
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
gulp-phpunit
Advanced tools
Gulp plugin to control phpUnit
First, install gulp-phpunit as a development dependency:
npm i -D gulp-phpunit
If you are using gulp-phpunit with laravel-elixir prior to version 4.0, it will install gulp-phpunit 0.9.0. If you wish to upgrade to the lastest version of gulp-phpunit, you can do so by performing the following:
$ cd node_modules/laravel-elixir
$ npm install -D gulp-phpunit@latest
As of this release, the current version of Elixir 4.0.x, notification messages are used throughout Elixir operation, thus you may want to disable gulp-phpunit default notifications.
This can be done using the optional options passed to mix.phpUnit as follows (for more information about available gulp-phpunit options, please refer to descriptions below)
elixir(function(mix) {
mix.phpUnit('',{notify: false}); // this will disable gulp-phpUnit internal notifications
});
After you have installed plugin, reference in to your gulpfile.js:
var phpunit = require('gulp-phpunit');
Option 1: Default format, equivelant to using phpunit in command line (no options).
var gulp = require('gulp');
var phpunit = require('gulp-phpunit');
gulp.task('phpunit', function() {
gulp.src('')
.pipe(phpunit());
});
Option 2: With defined bin and options.
var gulp = require('gulp');
var phpunit = require('gulp-phpunit');
gulp.task('phpunit', function() {
var options = {debug: false};
gulp.src('phpunit.xml')
.pipe(phpunit('./vendor/bin/phpunit',options));
});
Option 3: With custom options, using separate configuration file, disabling status line
var gulp = require('gulp');
var phpunit = require('gulp-phpunit');
gulp.task('phpunit', function() {
var options = {
debug: true,
statusLine: false,
configurationFile: './test.xml'
};
gulp.src('phpunit.xml')
.pipe(phpunit('./vendor/bin/phpunit', options));
});
Note: Windows OS may require double backslashes if using other than default location
var phpunit = require('gulp-phpunit');
gulp.task('phpunit', function() {
gulp.src('phpunit.xml')
.pipe(phpunit('.\\path\\to\\phpunit'));
});
Type: String
The path to the desired PHPUnit binary
./vendor/bin/phpunitType: Boolean
Default: false
Debug mode enabled (enables --debug switch as well)
Type: Boolean
Default: false
Clear console before executing command
Type: Boolean
Default: false
Executes dry run (doesn't actually execute tests, just echo command that would be executed)
Type: Boolean
Default: true
Conditionally display notification (both console and growl where applicable)
Type: Boolean
Default: true
Displays status lines as follows
debug property enabled (will also display red, green status)In addition to plugin options, the following PHPUnit specific options may be configured. For more information (and default values), visit the help supplied by PHPUnit
$ phpunit --help
Type: String
Define a specific class for testing (supply full path to test class)
Type: String
Define a specific test suite for testing (supply full path to test suite)
Type: String
Define a path to an xml configuration file (supply full path and filename)
.xml file supplied as task source, it will be used as configuration fileconfigurationFile property supplied in options, it will be used as configuration filenoConfigurationFile property, no configuration file will be usedCall user supplied callback to handle notification
Type: String
Generate code coverage report in Clover XML format.
Type: String
Generate code coverage report in Crap4J XML format.
Type: String
Generate code coverage report in HTML format.
Type: String
Export PHP_CodeCoverage object to file.
Type: String
Generate code coverage report in text format. -- Default: Standard output.
Type: String
Generate code coverage report in PHPUnit XML format.
Type: String
Log test execution in JUnit XML format to file.
Type: String
Log test execution in TAP format to file.
Type: String
Log test execution in JSON format.
Type: String
Write agile documentation in HTML format to file.
Type: String
Write agile documentation in Text format to file.
Type: String
Filter which tests to run.
Type: String
Filter which testsuite to run.
Type: String
Only runs tests from the specified group(s).
Type: String
Exclude tests from the specified group(s).
Type: String
List available test groups.
Type: String
Only search for test in files with specified suffix(es). Default: Test.php,.phpt
Type: String
Be strict about tests that do not test anything.
Type: Boolean
Be strict about unintentionally covered code.
Type: Boolean
Be strict about output during tests.
Type: Boolean
Enforce time limit based on test size.
Type: Boolean
Disallow @todo-annotated tests.
Type: Boolean
Run tests in strict mode (enables all of the above).
Type: Boolean
Run each test in a separate PHP process.
Type: Boolean
Do not backup and restore $GLOBALS for each test.
Type: Boolean
Backup and restore static attributes for each test.
Type: String
Default: always
Use colors in output ("never", "auto" or "always").
Note: If using PHPUnit < 4.8.x, you can disable colors using 'disabled' or 'enabled' options
phpunit('',{colors: 'disabled'}); // disable colors
phpunit('',{colors: 'enabled'}); // enable colors
Type: Boolean
Write to STDERR instead of STDOUT.
Type: Boolean
Stop execution upon first error.
Type: Boolean
Stop execution upon first error or failure.
Type: Boolean
Stop execution upon first risky test.
Type: Boolean
Stop execution upon first incomplete test.
Type: Boolean
Stop execution upon first skipped test.
Type: String
TestSuiteLoader implementation to use.
Type: Integer | String
Runs the test(s) repeatedly.
Type: Boolean
Report test execution progress in TAP format.
Type: Boolean
Report test execution progress in TestDox format.
Type: String
TestSuiteListener implementation to use.
Type: String
A "bootstrap" PHP file that is run before the tests.
Type: String
Read configuration from XML file.
Type: Boolean
Ignore default configuration file (phpunit.xml).
Type: Boolean
Prepend PHP's include_path with given path(s).
gulp-phpunit written by Mike Erickson
E-Mail: codedungeon@gmail.com
Twitter: @codedungeon
Website: codedungeon.org
FAQs
PHPUnit plugin for Gulp
The npm package gulp-phpunit receives a total of 1,653 weekly downloads. As such, gulp-phpunit popularity was classified as popular.
We found that gulp-phpunit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.