Skip to content

Instantly share code, notes, and snippets.

@ironprogrammer
Last active June 30, 2022 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ironprogrammer/606ad96a10a8d8d33370fa0174c8f863 to your computer and use it in GitHub Desktop.
Save ironprogrammer/606ad96a10a8d8d33370fa0174c8f863 to your computer and use it in GitHub Desktop.
WP-CLI-flavored Rollback Update Failure plugin testing reference

Testing the Rollback Update Failure Plugin

Hint: Preceding the following wp calls with the time command will provide execution timing to help with before and after patch comparisons. E.g. time wp plugin update --all.

Install the Plugin ⚙️

# install the Rollback Update Failure plugin (plugin to test)
wp plugin install rollback-update-failure --activate

# [OPTIONAL] install the Rollback Update Testing plugin (to simulate failures)
wp plugin install https://gist.github.com/afragen/80b68a6c8826ab37025b05d4519bb4bf/archive/a8858b736ff82301c239afb1b12f017309b3f8b2.zip

Plugin Tests 🛠

Configure/Reset

# install and reset plugins to old versions
wp plugin install akismet --version=4.2.3 --force
wp plugin install jetpack --version=10.9 --force
wp plugin install mailpoet --version=3.90.0 --force
wp plugin install woocommerce --version=6.6.0 --force

Single Plugin Updates

wp plugin update akismet
wp plugin update jetpack
wp plugin update mailpoet
wp plugin update woocommerce

# verify temp-backup directory is empty
ls wp-content/upgrade/temp-backup/plugins

Bulk Plugin Update

wp plugin update --all

# verify temp-backup directory is empty
ls wp-content/upgrade/temp-backup/plugins

Theme Tests 🎨

Configure/Reset

wp theme install twentytwentytwo --version=1.1 --force
wp theme install twentytwenty --version=1.9 --force
wp theme install avant-garde --version=1.1 --force
wp theme install kubrick2 --version=1.0 --force

Single Theme Updates

wp theme update twentytwentytwo
wp theme update twentytwenty
wp theme update avant-garde
wp theme update kubrick2

# verify temp-backup directory is empty
ls wp-content/upgrade/temp-backup/themes

Bulk Theme Update

wp theme update --all

# verify temp-backup directory is empty
ls wp-content/upgrade/temp-backup/themes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment