WP-CLI

A command line interface for WordPress

Commands » scaffold » plugin-tests

wp scaffold plugin-tests - Generate files needed for running PHPUnit tests in a plugin.

Quick links: Github issues


The following files are generated by default:

Learn more from the plugin unit tests documentation.

ENVIRONMENT

The tests/bootstrap.php file looks for the WP_TESTS_DIR environment variable.

OPTIONS

[<plugin>]
The name of the plugin to generate test files for.
[--dir=<dirname>]
Generate test files for a non-standard plugin path. If no plugin slug is specified, the directory name is used.
[--ci=<provider>]
Choose a configuration file for a continuous integration provider. -– default: travis options:
  • travis
  • circle
    • gitlab -–
[--force]
Overwrite files that already exist.

EXAMPLES

# Generate unit test files for plugin 'sample-plugin'.
$ wp scaffold plugin-tests sample-plugin
Success: Created test files.