Giter VIP home page Giter VIP logo

wp-cli-theme-test-command's Introduction

wp-cli theme-test command

Build Status - master Latest Stable Version

Install and configure Theme "unit tests" (sample data, required plugins and options) with wp-cli

http://codex.wordpress.org/Theme_Unit_Test

Installation

Default install: wp-cli + composer

Composer installation as referenced in wp-cli Community Packages setup.

  1. Make sure to have wp-cli already installed.

  2. Go to the directory containing the root composer.json file:

cd ~/.wp-cli
  1. Add the WP-CLI Package Index:
composer config repositories.wp-cli composer http://wp-cli.org/package-index/
  1. Install the package:
composer require pixline/wp-cli-theme-test-command=dev-master

Usage

NOTE: This command can't deal (yet?) with global flags like --path, please run it in the WordPress root folder.

wp theme-test install [options]

Angle brackets groups possible values, default is marked with *

[--data=< unit-test* | wpcom-theme | wpcom-demo | wptest | skip >]

	URL/path to custom WXR data file, or built-in:

	'unit-test' = Default Theme Unit Test datafile
	'wpcom-theme' = Alternative wpcom datafile (1)
	'wpcom-demo' = Alternative wpcom datafile (2)
	'wptest' = manovotny/wptest datafile
	'skip' = Do not install new data

[--plugin=< theme* | vip | devel | all | skip >]  

	Plugin bundle to install. 
	Bundles are as suggested in the 'developer' plugin,
	'debug' bundle is an exclusive feature :-) 

	'theme' = Default plugin setup
	'vip' = Default + wpcom VIP plugin setup
	'devel' = Default + plugin developer setup
	'debug' = Default + debugger setup
	'all' = Default + VIP + developer + debugger!
	'skip' = Do not install/activate plugin bundles

[--option=< default* | skip >]
	

	Updates blog options to the test default values.

	'skip' = Do not update options
	'default' = Updates options to their default test value:

		- blogname                WordPress Theme Unit Test Site
		- posts_per_page          5
		- thread_comments         1
		- thread_comments_depth   3
		- page_comments           1
		- comments_per_page       5
		- medium_max_w            null
		- medium_max_h            null
		- large_max_w             null
		- large_max_h             null
		- permalink_structure     /%year%/%monthnum%/%day%/%postname%/

[--menus]            Add custom nav menus

wp-cli-theme-test-command's People

Contributors

pixline avatar scribu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sarahmonster

wp-cli-theme-test-command's Issues

meaningful command line options

Actual command line options:

--data=<data> --menus --vip

Command have four steps, we need to make them scriptable. Proposal:

Default values marked with * 
[--plugin=]     ( theme* | vip | developer | skip ).
                should accept multiple values, i.e.: theme,vip
[--data=]       ( default* | custom URL | skip )
[--options=]    ( full* | skip )
[--menus]     

--menus fails when no pages in WP

check for pages count before!

PHP Warning:  array_rand(): Second argument has to be between 1 and the number of elements in the array in /src/wp-cli-theme-test-command/wp-cli-theme-test-command.php on line 31
PHP Stack trace:
PHP   1. {main}() /src/wp-cli-theme-test-command/vendor/wp-cli/wp-cli/php/boot-fs.php:0
PHP   2. include() /src/wp-cli-theme-test-command/vendor/wp-cli/wp-cli/php/boot-fs.php:17
PHP   3. WP_CLI\Runner->after_wp_load() /src/wp-cli-theme-test-command/vendor/wp-cli/wp-cli/php/wp-cli.php:37
PHP   4. WP_CLI\Runner->_run_command() /src/wp-cli-theme-test-command/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:369
PHP   5. WP_CLI::run_command() /src/wp-cli-theme-test-command/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:148
PHP   6. WP_CLI\Dispatcher\Subcommand->invoke() /src/wp-cli-theme-test-command/vendor/wp-cli/wp-cli/php/class-wp-cli.php:311
PHP   7. call_user_func() /src/wp-cli-theme-test-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:74
PHP   8. WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}() /src/wp-cli-theme-test-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:74
PHP   9. call_user_func() /src/wp-cli-theme-test-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:35
PHP  10. Theme_Test_Cmd->install() /src/wp-cli-theme-test-command/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:35
PHP  11. Theme_Test_Cmd->create_test_menus() /src/wp-cli-theme-test-command/wp-cli-theme-test-command.php:246
PHP  12. array_rand() /src/wp-cli-theme-test-command/wp-cli-theme-test-command.php:31

Failed image import

I ran wp theme-test install got this:

Failed to import Media &#8220;test-image-landscape-900&#8221;<br />Failed to import Media &#8220;test-image-portrait&#8221;<br />-- Added post_meta _wp_attachment_image_alt

Then this

-- Added post_meta _wp_attachment_image_alt
-- Added post_meta _attachment_original_parent_id
-- Added post_meta _wp_attachment_image_alt
-- Added post_meta _wp_attachment_image_alt
-- Added post_meta _attachment_original_parent_id

Then another

Failed to import Media &#8220;dsc20050727_091048_222&#8221;<br />Failed to import Media &#8220;dsc20050813_115856_52&#8221;<br />Failed to import Media &#8220;dsc20050831_165238_332&#8221;<br />Failed to import Media &#8220;dsc20050901_105100_212&#8221;<br />-- Added post_meta _wp_attachment_image_alt

Extra info
WP-CLI version: 0.11.0-alpha
```wordpress-importer: 0.6`

Updated the importer
Ok I saw that I didn't install the wordpress-importer but just kept it at 0.6.
Updated it to wordpress-importer: 0.6.1 and ran the command again.
Everything ok.

So maybe use the new plugin install wordpress-importer --force to install this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.