Feature: Manage WordPress themes and plugins Background: Given an empty cache Scenario Outline: Installing, upgrading and deleting a theme or plugin Given a WP install And I run `wp path` And save STDOUT as {CONTENT_DIR} When I try `wp is-installed ` Then the return code should be 1 And STDERR should be empty And STDOUT should be empty When I try `wp is-active ` Then the return code should be 1 And STDERR should be empty And STDOUT should be empty When I try `wp get ` Then the return code should be 1 And STDERR should not be empty And STDOUT should be empty # Install an out of date from WordPress.org repository When I run `wp install --version=` Then STDOUT should contain: """ installed successfully """ And the {SUITE_CACHE_DIR}//-.zip file should exist When I run `wp is-installed ` Then the return code should be 0 When I run `wp get ` Then STDOUT should be a table containing rows: | Field | Value | | title | | When I run `wp get --field=title` Then STDOUT should contain: """ """ When I run `wp get --field=title --format=json` Then STDOUT should contain: """ "" """ When I run `wp list --name= --field=update_version` Then STDOUT should not be empty And save STDOUT as {UPDATE_VERSION} When I run `wp list` Then STDOUT should be a table containing rows: | name | status | update | version | update_version | auto_update | | | inactive | available | | {UPDATE_VERSION} | off | When I run `wp list --field=name` Then STDOUT should contain: """ """ When I run `wp list --field=name --format=json` Then STDOUT should be a JSON array containing: """ [""] """ When I run `wp status` Then STDOUT should contain: """ U = Update Available """ When I run `wp status ` Then STDOUT should contain: """ Status: Inactive Version: (Update available) """ When I run `wp update ` And save STDOUT 'Downloading update from .*\/\.%s\.zip' as {NEW_VERSION} And STDOUT should not be empty Then STDOUT should not contain: """ Error """ And the {SUITE_CACHE_DIR}//-{NEW_VERSION}.zip file should exist # This can throw warnings about versions being higher than expected. When I try `wp update --all 2>&1` Then STDOUT should contain: """ updated """ When I run `wp status ` Then STDOUT should not contain: """ (Update available) """ When I run `wp delete ` Then STDOUT should contain: """ Deleted '' . """ When I try `wp status ` Then the return code should be 1 And STDERR should not be empty And STDOUT should be empty # Install and update from cache When I run `wp install --version=` Then STDOUT should contain: """ Using cached file '{SUITE_CACHE_DIR}//-.zip'... """ When I run `wp update ` Then STDOUT should contain: """ Using cached file '{SUITE_CACHE_DIR}//-{NEW_VERSION}.zip'... """ When I run `wp delete ` Then STDOUT should contain: """ Deleted '' . """ And the file should not exist # Install from a local zip file When I run `wp install {SUITE_CACHE_DIR}//-.zip` Then STDOUT should contain: """ installed successfully. """ And the file should exist When I run `wp delete ` Then STDOUT should contain: """ Deleted '' . """ And the file should not exist # Install from a remote zip file (standard URL with no GET parameters) When I run `wp install ` Then STDOUT should contain: """ installed successfully. """ And the file should exist When I run `wp delete ` Then STDOUT should contain: """ Deleted '' . """ And the file should not exist # Install from a remote zip file (complex URL with GET parameters) When I run `wp install '?AWSAccessKeyId=123&Expires=456&Signature=abcdef'` Then STDOUT should contain: """ installed successfully. """ And the file should exist When I run `wp delete ` Then STDOUT should contain: """ Deleted '' . """ And the file should not exist When I run `wp list --fields=name` Then STDOUT should not contain: """ """ When I try `wp install an-impossible-slug-because-abc3fr` Then STDERR should contain: """ Warning: """ And STDERR should contain: """ an-impossible-slug-because-abc3fr """ And STDERR should contain: """ Error: No s installed. """ And STDOUT should be empty And the return code should be 1 Examples: | type | type_name | item | item_title | version | zip_file | file_to_check | | theme | Theme | moina | Moina | 1.1.2 | https://wordpress.org/themes/download/moina.1.1.2.zip | {CONTENT_DIR}/moina/style.css | | plugin | Plugin | category-checklist-tree | Category Checklist Tree | 1.2 | https://downloads.wordpress.org/plugin/category-checklist-tree.1.2.zip | {CONTENT_DIR}/category-checklist-tree/category-checklist-tree.php |