在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mikeerickson/gulp-phpunit开源软件地址(OpenSource Url):https://github.com/mikeerickson/gulp-phpunit开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-phpunitGulp plugin to control PHPUnit InstallationFirst, install
UsageAfter you have installed plugin, reference in to your var phpunit = require('gulp-phpunit'); Option 1: Default format, equivelant to using 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));
}); Option 4: Using callback when testing completed var gulp = require('gulp');
var phpunit = require('gulp-phpunit');
gulp.task('phpunit', function() {
gulp.src('phpunit.xml')
.pipe(phpunit('./vendor/bin/phpunit', {}, function(err, msg) {
// null if no error
// 1 if error
if(err) {
console.log('Error' + err);
}
console.log(msg);
}));
}); 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'));
}); APIphpunit(phpunitpath,options, [callback])phpunitpathType: The path to the desired PHPUnit binary
options.debugType: Debug mode enabled (enables --debug switch as well) options.clearType: Clear console before executing command options.dryRunType: Executes dry run (doesn't actually execute tests, just echo command that would be executed) options.notifyType: Conditionally display notification (both console and growl where applicable) options.statusLineType: Displays status lines as follows
PHPUnit OptionsIn 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 options.testClassType: Define a specific class for testing (supply full path to test class) options.testSuiteType: Define a specific test suite for testing (supply full path to test suite) options.configurationFileType: Define a path to an xml configuration file (supply full path and filename)
callbackType: You may supply an optional callback which will be called when testing has completed. The callback follows the standard nodejs callback signature function callback(err, msg) {} Code Coverage Options:Call user supplied callback to handle notification options.coverageCloverType: Generate code coverage report in Clover XML format. options.coverageCrap4jType: Generate code coverage report in Crap4J XML format. options.coverageHtmlType: Generate code coverage report in HTML format. options.coveragePhpType: Export PHP_CodeCoverage object to file. options.coverageTextType: Generate code coverage report in text format. -- Default: Standard output. options.coverageXmlType: Generate code coverage report in PHPUnit XML format. Logging Options:options.logJunitType: Log test execution in JUnit XML format to file. options.logTapType: Log test execution in TAP format to file. options.logJsonType: Log test execution in JSON format. options.testdoxHtmlType: Write agile documentation in HTML format to file. options.testdoxTextType: Write agile documentation in Text format to file. Test Selection Options:options.filter (pattern)Type: Filter which tests to run. options.testSuite (pattern)Type: Filter which testsuite to run. options.group (pattern)Type: Only runs tests from the specified group(s). options.excludeGroupType: Exclude tests from the specified group(s). options.listGroupsType: List available test groups. options.testSuffixType: Only search for test in files with specified suffix(es). Default: Test.php,.phpt Test Execution Options:options.reportUselessTestsType: Be strict about tests that do not test anything. options.strictCoverage (default: false)Type: Be strict about unintentionally covered code. options.disallowTestOutput (default: false)Type: Be strict about output during tests. options.enforceTimeLimit (default: false)Type: Enforce time limit based on test size. options.disallowTodoTests (default: false)Type: Disallow @todo-annotated tests. options.strict (default: false)Type: Run tests in strict mode (enables all of the above). options.processIsolation (default: false)Type: Run each test in a separate PHP process. options.noGlobalsBackup (default: false)Type: Do not backup and restore $GLOBALS for each test. options.staticBackup (default: false)Type: Backup and restore static attributes for each test. options.colors (default: 'always')Type: Use colors in output ("never", "auto" or "always"). Note: If using PHPUnit < 4.8.x, you can disable colors using 'disabled' or 'enabled' options
options.stderr (default: false)Type: Write to STDERR instead of STDOUT. options.stopOnError (default: false)Type: Stop execution upon first error. options.stopOnFailure (default: false)Type: Stop execution upon first error or failure. options.stopOnRisky (default: false)Type: Stop execution upon first risky test. options.stopOnIncomplete (default: false)Type: Stop execution upon first incomplete test. options.stopOnSkipped (default: false)Type: Stop execution upon first skipped test. options.loaderType: TestSuiteLoader implementation to use. options.repeatType: Runs the test(s) repeatedly. options.tapType: Report test execution progress in TAP format. options.testdoxType: Report test execution progress in TestDox format. options.printerType: TestSuiteListener implementation to use. Configuration Optionsoptions.bootstrapType: A "bootstrap" PHP file that is run before the tests. options.configurationFileType: Read configuration from XML file. options.noConfigurationType: Ignore default configuration file (phpunit.xml). options.includePathType: Prepend PHP's include_path with given path(s). Creditsgulp-phpunit written by Mike Erickson E-Mail: [email protected] Twitter: @codedungeon Website: github.com/mikeerickson |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论