Skip to content

Instantly share code, notes, and snippets.

@pixline
Last active December 19, 2015 04:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixline/5895867 to your computer and use it in GitHub Desktop.
Save pixline/5895867 to your computer and use it in GitHub Desktop.
(draft) wp-cli theme unit test setup automation
<?php
$download_url = 'https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml';
$silent = WP_CLI::get_config('quiet') ? '--silent ' : '';
$cmd = "curl -f $silent %s -o /tmp/theme-unit-test-data.xml";
WP_CLI::launch( Utils\esc_cmd( $cmd, $download_url ) );
# reset wp
WP_CLI::launch( 'wp db reset --yes' );
# install wp (install config file? args? both?)
WP_CLI::launch( 'wp core install --url=<$url> --title=<$title> --admin_name=<$admin> --admin_email=<$email> --admin_password=<$password>' );
# import xml
WP_CLI::launch( 'wp import /tmp/theme-unit-test-data.xml --authors=skip' );
# install plugins
WP_CLI::launch( 'wp plugin install developer --activate' );
WP_CLI::launch( 'wp plugin install theme-check --activate' );
WP_CLI::launch( 'wp plugin install debug-bar --activate' );
WP_CLI::launch( 'wp plugin install log-deprecated-notices --activate' );
WP_CLI::launch( 'wp plugin install debogger --activate' );
WP_CLI::launch( 'wp plugin install monster-widget --activate' );
WP_CLI::launch( 'wp plugin install wordpress-beta-tester --activate' );
WP_CLI::launch( 'wp plugin install regenerate-thumbnails --activate' );
# options
WP_CLI::launch( 'wp option update blogname "WordPress Theme Unit Test Site"' );
WP_CLI::launch( 'wp option update posts_per_page 5' );
WP_CLI::launch( 'wp option update thread_comments 1' );
WP_CLI::launch( 'wp option update thread_comments_depth 3' );
WP_CLI::launch( 'wp option update page_comments 1' );
WP_CLI::launch( 'wp option update comments_per_page 5' );
WP_CLI::launch( 'wp option update medium_max_w ""' );
WP_CLI::launch( 'wp option update medium_max_h ""' );
WP_CLI::launch( 'wp option update large_max_w ""' );
WP_CLI::launch( 'wp option update large_max_h ""' );
WP_CLI::launch( 'wp option update permalink_structure "/%year%/%monthnum%/%day%/%postname%/"' );
# create long custom menu, all pages
# create short custom menu, 2/3 pages
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment