PHP Class Scaffold_Command, wp-cli

Inheritance: extends WP_CLI_Command
Mostrar archivo Open project: wp-cli/wp-cli

Public Methods

Method Description
_s ( $args, $assoc_args ) Generate starter code for a theme based on _s.
child_theme ( $args, $assoc_args ) Generate child theme based on an existing theme.
plugin ( $args, $assoc_args ) Generate starter code for a plugin.
plugin_tests ( $args, $assoc_args ) Generate files needed for running PHPUnit tests in a plugin.
post_type ( $args, $assoc_args ) Generate PHP code for registering a custom post type.
taxonomy ( $args, $assoc_args ) Generate PHP code for registering a custom taxonomy.
theme_tests ( $args, $assoc_args ) Generate files needed for running PHPUnit tests in a theme.

Protected Methods

Method Description
extract_args ( $assoc_args, $defaults )
maybe_create_plugins_dir ( ) Create the plugins directory if it doesn't already exist
maybe_create_themes_dir ( ) Create the themes directory if it doesn't already exist
quote_comma_list_elements ( $comma_list )

Private Methods

Method Description
_scaffold ( $slug, $assoc_args, $defaults, $subdir, $templates )
create_files ( $files_and_contents, $force )
get_output_path ( $assoc_args, $subdir )
get_textdomain ( $textdomain, $args ) If you're writing your files to your theme directory your textdomain also needs to be the same as your theme.
init_wp_filesystem ( ) Initialize WP Filesystem
log_whether_files_written ( $files_written, $skip_message, $success_message )
pluralize ( $word )
prompt_if_files_will_be_overwritten ( $filename, $force )
scaffold_plugin_theme_tests ( $args, $assoc_args, $type )

Method Details

_s() public method

See the Underscores website for more details. ## OPTIONS : The slug for the new theme, used for prefixing functions. [--activate] : Activate the newly downloaded theme. [--enable-network] : Enable the newly downloaded theme for the entire network. [--theme_name=] : What to put in the 'Theme Name:' header in 'style.css'. [--author=<full-name>] : What to put in the 'Author:' header in 'style.css'. [--author_uri=<uri>] : What to put in the 'Author URI:' header in 'style.css'. [--sassify] : Include stylesheets as SASS. [--force] : Overwrite files that already exist. ## EXAMPLES # Generate a theme with name "Sample Theme" and author "John Doe" $ wp scaffold _s sample-theme --theme_name="Sample Theme" --author="John Doe" Success: Created theme 'Sample Theme'. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-_s">_s</a></span> ( <span class="param-name">$args</span>, <span class="param-name">$assoc_args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-child_theme"> <div class="row"> <div class="col-md-6"> <h3> child_theme() <span class="modifier">public</span > <span>method</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/es/method/-/Scaffold_Command/child_theme/-" rel="nofollow" title="Source code of method Scaffold_Command::child_theme"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-child_theme" title="Direct link to the method Scaffold_Command::child_theme documentation"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> Creates a child theme folder with <span class='highlight'>functions.php</span> and <span class='highlight'>style.css</span> files. ## OPTIONS <slug> : The slug for the new child theme. --parent_theme=<slug> : What to put in the 'Template:' header in 'style.css'. [--theme_name=<title>] : What to put in the 'Theme Name:' header in 'style.css'. [--author=<full-name>] : What to put in the 'Author:' header in 'style.css'. [--author_uri=<uri>] : What to put in the 'Author URI:' header in 'style.css'. [--theme_uri=<uri>] : What to put in the 'Theme URI:' header in 'style.css'. [--activate] : Activate the newly created child theme. [--enable-network] : Enable the newly created child theme for the entire network. [--force] : Overwrite files that already exist. ## EXAMPLES # Generate a 'sample-theme' child theme based on TwentySixteen $ wp scaffold child-theme sample-theme --parent_theme=twentysixteen Success: Created '/var/www/example.com/public_html/wp-content/themes/sample-theme'. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-child_theme">child_theme</a></span> ( <span class="param-name">$args</span>, <span class="param-name">$assoc_args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-extract_args"> <div class="row"> <div class="col-md-6"> <h3> extract_args() <span class="modifier">protected</span > <span>method</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/es/method/-/Scaffold_Command/extract_args/-" rel="nofollow" title="Source code of method Scaffold_Command::extract_args"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-extract_args" title="Direct link to the method Scaffold_Command::extract_args documentation"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> </div> </div> <div class="row doc-tags"> <div class="col-md-12"> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">protected</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-extract_args">extract_args</a></span> ( <span class="param-name">$assoc_args</span>, <span class="param-name">$defaults</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-maybe_create_plugins_dir"> <div class="row"> <div class="col-md-6"> <h3> maybe_create_plugins_dir() <span class="modifier">protected</span > <span>method</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/es/method/-/Scaffold_Command/maybe_create_plugins_dir/-" rel="nofollow" title="Source code of method Scaffold_Command::maybe_create_plugins_dir"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-maybe_create_plugins_dir" title="Direct link to the method Scaffold_Command::maybe_create_plugins_dir documentation"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> Create the plugins directory if it doesn't already exist </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">protected</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-maybe_create_plugins_dir">maybe_create_plugins_dir</a></span> ( ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-maybe_create_themes_dir"> <div class="row"> <div class="col-md-6"> <h3> maybe_create_themes_dir() <span class="modifier">protected</span > <span>method</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/es/method/-/Scaffold_Command/maybe_create_themes_dir/-" rel="nofollow" title="Source code of method Scaffold_Command::maybe_create_themes_dir"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-maybe_create_themes_dir" title="Direct link to the method Scaffold_Command::maybe_create_themes_dir documentation"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> Create the themes directory if it doesn't already exist </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">protected</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-maybe_create_themes_dir">maybe_create_themes_dir</a></span> ( ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-plugin"> <div class="row"> <div class="col-md-6"> <h3> plugin() <span class="modifier">public</span > <span>method</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/es/method/-/Scaffold_Command/plugin/-" rel="nofollow" title="Source code of method Scaffold_Command::plugin"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-plugin" title="Direct link to the method Scaffold_Command::plugin documentation"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> The following files are always generated: * <span class='highlight'>plugin-slug.php</span> is the main PHP plugin file. * <span class='highlight'>readme.txt</span> is the readme file for the plugin. * <span class='highlight'>package.json</span> needed by NPM holds various metadata relevant to the project. Packages: <span class='highlight'>grunt</span>, <span class='highlight'>grunt-wp-i18n</span> and <span class='highlight'>grunt-wp-readme-to-markdown</span>. * <span class='highlight'>Gruntfile.js</span> is the JS file containing Grunt tasks. Tasks: <span class='highlight'>i18n</span> containing <span class='highlight'>addtextdomain</span> and <span class='highlight'>makepot</span>, <span class='highlight'>readme</span> containing <span class='highlight'>wp_readme_to_markdown</span>. * <span class='highlight'>.editorconfig</span> is the configuration file for Editor. * <span class='highlight'>.gitignore</span> tells which files (or patterns) git should ignore. * <span class='highlight'>.distignore</span> tells which files and folders should be ignored in distribution. The following files are also included unless the <span class='highlight'>--skip-tests</span> is used: * <span class='highlight'>phpunit.xml.dist</span> is the configuration file for PHPUnit. * <span class='highlight'>.travis.yml</span> is the configuration file for Travis CI. Use <span class='highlight'>--ci=<provider></span> to select a different service. * <span class='highlight'>bin/install-wp-tests.sh</span> configures the WordPress test suite and a test database. * <span class='highlight'>tests/bootstrap.php</span> is the file that makes the current plugin active when running the test suite. * <span class='highlight'>tests/test-sample.php</span> is a sample file containing test cases. * <span class='highlight'>phpcs.ruleset.xml</span> is a collenction of PHP_CodeSniffer rules. ## OPTIONS <slug> : The internal name of the plugin. [--dir=<dirname>] : Put the new plugin in some arbitrary directory path. Plugin directory will be path plus supplied slug. [--plugin_name=<title>] : What to put in the 'Plugin Name:' header. [--plugin_description=<description>] : What to put in the 'Description:' header. [--plugin_author=<author>] : What to put in the 'Author:' header. [--plugin_author_uri=<url>] : What to put in the 'Author URI:' header. [--plugin_uri=<url>] : What to put in the 'Plugin URI:' header. [--skip-tests] : Don't generate files for unit testing. [--ci=<provider>] : Choose a configuration file for a continuous integration provider. --- default: travis options: - travis - circle - gitlab --- [--activate] : Activate the newly generated plugin. [--activate-network] : Network activate the newly generated plugin. [--force] : Overwrite files that already exist. ## EXAMPLES $ wp scaffold plugin sample-plugin Success: Created plugin files. Success: Created test files. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-plugin">plugin</a></span> ( <span class="param-name">$args</span>, <span class="param-name">$assoc_args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-plugin_tests"> <div class="row"> <div class="col-md-6"> <h3> plugin_tests() <span class="modifier">public</span > <span>method</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/es/method/-/Scaffold_Command/plugin_tests/-" rel="nofollow" title="Source code of method Scaffold_Command::plugin_tests"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-plugin_tests" title="Direct link to the method Scaffold_Command::plugin_tests documentation"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> The following files are generated by default: * <span class='highlight'>phpunit.xml.dist</span> is the configuration file for PHPUnit. * <span class='highlight'>.travis.yml</span> is the configuration file for Travis CI. Use <span class='highlight'>--ci=<provider></span> to select a different service. * <span class='highlight'>bin/install-wp-tests.sh</span> configures the WordPress test suite and a test database. * <span class='highlight'>tests/bootstrap.php</span> is the file that makes the current plugin active when running the test suite. * <span class='highlight'>tests/test-sample.php</span> is a sample file containing the actual tests. * <span class='highlight'>phpcs.ruleset.xml</span> is a collenction of PHP_CodeSniffer rules. Learn more from the <a href="http://wp-cli.org/docs/plugin-unit-tests/">plugin unit tests documentation</a>. ## ENVIRONMENT The <span class='highlight'>tests/bootstrap.php</span> 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. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-plugin_tests">plugin_tests</a></span> ( <span class="param-name">$args</span>, <span class="param-name">$assoc_args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-post_type"> <div class="row"> <div class="col-md-6"> <h3> post_type() <span class="modifier">public</span > <span>method</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/es/method/-/Scaffold_Command/post_type/-" rel="nofollow" title="Source code of method Scaffold_Command::post_type"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-post_type" title="Direct link to the method Scaffold_Command::post_type documentation"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> ## OPTIONS <slug> : The internal name of the post type. [--label=<label>] : The text used to translate the update messages. [--textdomain=<textdomain>] : The textdomain to use for the labels. [--dashicon=<dashicon>] : The dashicon to use in the menu. [--theme] : Create a file in the active theme directory, instead of sending to STDOUT. Specify a theme with <span class='highlight'>--theme=<theme></span> to have the file placed in that theme. [--plugin=<plugin>] : Create a file in the given plugin's directory, instead of sending to STDOUT. [--raw] : Just generate the <span class='highlight'>register_post_type()</span> call and nothing else. [--force] : Overwrite files that already exist. ## EXAMPLES # Generate a 'movie' post type for the 'simple-life' theme $ wp scaffold post-type movie --label=Movie --theme=simple-life Success: Created '/var/www/example.com/public_html/wp-content/themes/simple-life/post-types/movie.php'. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-post_type">post_type</a></span> ( <span class="param-name">$args</span>, <span class="param-name">$assoc_args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-quote_comma_list_elements"> <div class="row"> <div class="col-md-6"> <h3> quote_comma_list_elements() <span class="modifier">protected</span > <span>method</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/es/method/-/Scaffold_Command/quote_comma_list_elements/-" rel="nofollow" title="Source code of method Scaffold_Command::quote_comma_list_elements"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-quote_comma_list_elements" title="Direct link to the method Scaffold_Command::quote_comma_list_elements documentation"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> </div> </div> <div class="row doc-tags"> <div class="col-md-12"> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">protected</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-quote_comma_list_elements">quote_comma_list_elements</a></span> ( <span class="param-name">$comma_list</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-taxonomy"> <div class="row"> <div class="col-md-6"> <h3> taxonomy() <span class="modifier">public</span > <span>method</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/es/method/-/Scaffold_Command/taxonomy/-" rel="nofollow" title="Source code of method Scaffold_Command::taxonomy"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-taxonomy" title="Direct link to the method Scaffold_Command::taxonomy documentation"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> ## OPTIONS <slug> : The internal name of the taxonomy. [--post_types=<post-types>] : Post types to register for use with the taxonomy. [--label=<label>] : The text used to translate the update messages. [--textdomain=<textdomain>] : The textdomain to use for the labels. [--theme] : Create a file in the active theme directory, instead of sending to STDOUT. Specify a theme with <span class='highlight'>--theme=<theme></span> to have the file placed in that theme. [--plugin=<plugin>] : Create a file in the given plugin's directory, instead of sending to STDOUT. [--raw] : Just generate the <span class='highlight'>register_taxonomy()</span> call and nothing else. [--force] : Overwrite files that already exist. ## EXAMPLES # Generate PHP code for registering a custom taxonomy and save in a file $ wp scaffold taxonomy venue --post_types=event,presentation > taxonomy.php </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-taxonomy">taxonomy</a></span> ( <span class="param-name">$args</span>, <span class="param-name">$assoc_args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-theme_tests"> <div class="row"> <div class="col-md-6"> <h3> theme_tests() <span class="modifier">public</span > <span>method</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/es/method/-/Scaffold_Command/theme_tests/-" rel="nofollow" title="Source code of method Scaffold_Command::theme_tests"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-theme_tests" title="Direct link to the method Scaffold_Command::theme_tests documentation"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> The following files are generated by default: * <span class='highlight'>phpunit.xml.dist</span> is the configuration file for PHPUnit. * <span class='highlight'>.travis.yml</span> is the configuration file for Travis CI. Use <span class='highlight'>--ci=<provider></span> to select a different service. * <span class='highlight'>bin/install-wp-tests.sh</span> configures the WordPress test suite and a test database. * <span class='highlight'>tests/bootstrap.php</span> is the file that makes the current theme active when running the test suite. * <span class='highlight'>tests/test-sample.php</span> is a sample file containing the actual tests. * <span class='highlight'>phpcs.ruleset.xml</span> is a collenction of PHP_CodeSniffer rules. Learn more from the <a href="http://wp-cli.org/docs/plugin-unit-tests/">plugin unit tests documentation</a>. ## ENVIRONMENT The <span class='highlight'>tests/bootstrap.php</span> file looks for the WP_TESTS_DIR environment variable. ## OPTIONS [<theme>] : The name of the theme to generate test files for. [--dir=<dirname>] : Generate test files for a non-standard theme path. If no theme 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 theme 'twentysixteenchild'. $ wp scaffold theme-tests twentysixteenchild Success: Created test files. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/es/class/-/Scaffold_Command#method-theme_tests">theme_tests</a></span> ( <span class="param-name">$args</span>, <span class="param-name">$assoc_args</span> ) </td> </tr> </table> </div> </div> </div> </div> </div> </div></div> <footer class="footer"> <div class="container"> <div class="row"> <div class="col-md-12" style="text-align: center"> <a href="https://hotexamples.com/es/site/trends?type=php%7Cf">Mejores funciones</a> | <a href="https://hotexamples.com/es/site/trends?type=php%7Cc"> Mejores clases </a> | <a href="https://doc.hotexamples.com/es/doc/map">Documentación</a> | <a href="/site/privacy">Política de privacidad</a> | <a href="https://cpp.hotexamples.com/direct-sales.html">Advertise with us</a> </div> </div> <div class="row"> <div class="col-md-12" style="text-align: center"> <a href="https://hotexamples.com/es/">PHP</a> | <a href="https://csharp.hotexamples.com/es/">C# (CSharp)</a> | <a href="https://java.hotexamples.com/es/">Java</a> | <a href="https://golang.hotexamples.com/es/">Golang</a> | <a href="https://cpp.hotexamples.com/es/">C++ (Cpp)</a> | <a href="https://python.hotexamples.com/es/">Python</a> | <a href="https://javascript.hotexamples.com/es/">JavaScript</a> | <a href="https://typescript.hotexamples.com/es/">TypeScript</a> </div> </div> <div class="row"> <div class="col-md-12" style="text-align: center"> <a href="https://doc.hotexamples.com/class/-/Scaffold_Command">EN</a> | <a href="https://doc.hotexamples.com/ru/class/-/Scaffold_Command">RU</a> | <a href="https://doc.hotexamples.com/de/class/-/Scaffold_Command">DE</a> | <a href="https://doc.hotexamples.com/fr/class/-/Scaffold_Command">FR</a> | <a href="https://doc.hotexamples.com/es/class/-/Scaffold_Command">ES</a> | <a href="https://doc.hotexamples.com/pt/class/-/Scaffold_Command">PT</a> | <a href="https://doc.hotexamples.com/it/class/-/Scaffold_Command">IT</a> | <a href="https://doc.hotexamples.com/jp/class/-/Scaffold_Command">JP</a> | <a href="https://doc.hotexamples.com/zh/class/-/Scaffold_Command">ZH</a> | <a href="https://doc.hotexamples.com/ko/class/-/Scaffold_Command">KO</a> </div> </div> <div class="row"> <div class="col-md-10 col-md-offset-1"> </div> <div class="col-md-1"> <!--LiveInternet counter--> <script type="text/javascript"><!-- document.write("<a href='//www.liveinternet.ru/click' " + "target=_blank><img src='//counter.yadro.ru/hit?t44.6;r" + escape(document.referrer) + ((typeof (screen) == "undefined") ? "" : ";s" + screen.width + "*" + screen.height + "*" + (screen.colorDepth ? screen.colorDepth : screen.pixelDepth)) + ";u" + escape(document.URL) + ";" + Math.random() + "' alt='' title='LiveInternet' " + "border='0' width='31' height='31'><\/a>"); //--></script><!--/LiveInternet--> </div> </div> </div> </footer> <script src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="/assets/30dd86a6f06b64184847037c52c63e07aa3c9a26.js"></script> <script>jQuery(function ($) { jQuery('#search-form').yiiActiveForm([{"id":"searchform-lang","name":"lang","container":".field-searchform-lang","input":"#searchform-lang","enableAjaxValidation":true},{"id":"searchform-search","name":"search","container":".field-searchform-search","input":"#searchform-search","enableAjaxValidation":true,"validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"Search no puede estar vacío."});}}], []); });</script></body> </html>