diff --git a/composer.json b/composer.json index 2e959323..6ba67a34 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "wp-cli/entity-command": "^1.3 || ^2 || ^3", "wp-cli/language-command": "^2.0 || ^3", "wp-cli/scaffold-command": "^1.2 || ^2 || ^3", - "wp-cli/wp-cli-tests": "^5" + "wp-cli/wp-cli-tests": "^5.4.0" }, "config": { "process-timeout": 7200, diff --git a/features/plugin-list-wporg-status.feature b/features/plugin-list-wporg-status.feature index 63eacb0d..f6db7793 100644 --- a/features/plugin-list-wporg-status.feature +++ b/features/plugin-list-wporg-status.feature @@ -3,7 +3,10 @@ Feature: Check the status of plugins on WordPress.org @require-wp-5.2 Scenario: Install plugins and check the status on wp.org. Given a WP install - And I run `wp plugin install wordpress-importer --version=0.5 --force` + And these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ And I run `wp plugin install https://downloads.wordpress.org/plugin/no-longer-in-directory.1.0.62.zip` And a wp-content/plugins/never-wporg/never-wporg.php file: """ @@ -114,7 +117,10 @@ Feature: Check the status of plugins on WordPress.org @require-wp-5.2 Scenario: The wp.org last updated date for an active plugin does not depend on a second, rate-limited request Given a WP install - And I run `wp plugin install wordpress-importer --version=0.5 --force` + And these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with: """ HTTP/1.1 200 @@ -146,7 +152,10 @@ Feature: Check the status of plugins on WordPress.org @require-wp-5.2 Scenario: The wp.org last updated date falls back to the trac log when the plugin-info API omits it Given a WP install - And I run `wp plugin install wordpress-importer --version=0.5 --force` + And these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with: """ HTTP/1.1 200 @@ -180,7 +189,10 @@ Feature: Check the status of plugins on WordPress.org @require-wp-5.2 Scenario: The wp.org last updated date falls back to the trac log when the plugin-info API date can't be parsed Given a WP install - And I run `wp plugin install wordpress-importer --version=0.5 --force` + And these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with: """ HTTP/1.1 200 @@ -217,7 +229,10 @@ Feature: Check the status of plugins on WordPress.org @require-wp-5.2 Scenario: The wp.org last updated date stays empty when the trac log pubDate can't be parsed Given a WP install - And I run `wp plugin install wordpress-importer --version=0.5 --force` + And these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with: """ HTTP/1.1 200 diff --git a/features/plugin-uninstall.feature b/features/plugin-uninstall.feature index 7bc719ab..b675f233 100644 --- a/features/plugin-uninstall.feature +++ b/features/plugin-uninstall.feature @@ -159,7 +159,10 @@ Feature: Uninstall a WordPress plugin @require-wp-5.2 Scenario: Uninstalling a plugin should remove its language pack Given a WP install - And I run `wp plugin install wordpress-importer` + And these installed plugins: + """ + wordpress-importer + """ And I run `wp language core install fr_FR` And I run `wp site switch-language fr_FR` @@ -185,7 +188,10 @@ Feature: Uninstall a WordPress plugin @require-wp-5.2 Scenario: Uninstalling a plugin should remove its update info Given a WP install - And I run `wp plugin install wordpress-importer --version=0.6` + And these installed plugins: + """ + wordpress-importer --version=0.6 + """ And I try `wp plugin status wordpress-importer` And I run `wp transient get --network update_plugins` diff --git a/features/plugin-update.feature b/features/plugin-update.feature index 3bb88744..fe5a57f0 100644 --- a/features/plugin-update.feature +++ b/features/plugin-update.feature @@ -81,7 +81,10 @@ Feature: Update WordPress plugins @require-wp-5.2 Scenario: Update a plugin to its latest patch release Given a WP install - And I run `wp plugin install --force wordpress-importer --version=0.5` + And these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ When I run `wp plugin update wordpress-importer --patch` Then STDOUT should contain: @@ -99,7 +102,10 @@ Feature: Update WordPress plugins @require-wp-5.8 Scenario: Update a plugin to its latest minor release Given a WP install - And I run `wp plugin install --force akismet --version=2.5.4` + And these installed plugins: + """ + akismet --version=2.5.4 --force + """ When I run `wp plugin update akismet --minor` Then STDOUT should contain: @@ -134,7 +140,10 @@ Feature: Update WordPress plugins """ # One plugin installed. - Given I run `wp plugin install wordpress-importer --version=0.5 --force` + Given these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ When I try `wp plugin update` Then the return code should be 1 @@ -170,7 +179,10 @@ Feature: Update WordPress plugins """ # Two plugins installed. - Given I run `wp plugin install akismet --version=2.5.4` + Given these installed plugins: + """ + akismet --version=2.5.4 + """ When I run `wp plugin update --all` Then STDOUT should contain: @@ -202,7 +214,10 @@ Feature: Update WordPress plugins @require-wp-5.8 @skip-windows Scenario: Plugin updates that error should not report a success Given a WP install - And I run `wp plugin install --force akismet --version=4.0` + And these installed plugins: + """ + akismet --version=4.0 --force + """ When I run `chmod -w wp-content/plugins/akismet` And I try `wp plugin update akismet` @@ -374,7 +389,10 @@ Feature: Update WordPress plugins @require-wp-5.2 @skip-windows Scenario: Failed plugin update keeps JSON output parseable Given a WP install - And I run `wp plugin install wordpress-importer --version=0.5 --force` + And these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ And I run `chmod -w wp-content/plugins/wordpress-importer` When I try `wp plugin update wordpress-importer --format=json` @@ -390,7 +408,10 @@ Feature: Update WordPress plugins @require-wp-5.2 @skip-windows Scenario: Failed plugin update keeps CSV output parseable Given a WP install - And I run `wp plugin install wordpress-importer --version=0.5 --force` + And these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ And I run `chmod -w wp-content/plugins/wordpress-importer` When I try `wp plugin update wordpress-importer --format=csv` @@ -406,7 +427,10 @@ Feature: Update WordPress plugins @require-wp-5.2 @skip-windows Scenario: Skip plugin update when plugin directory is a VCS checkout Given a WP install - And I run `wp plugin install wordpress-importer --version=0.5 --force` + And these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ And I run `wp plugin path wordpress-importer --dir` And save STDOUT as {PLUGIN_DIR} @@ -426,7 +450,10 @@ Feature: Update WordPress plugins @require-wp-5.2 @skip-windows Scenario: Update plugin in VCS checkout when --include-vcs is set Given a WP install - And I run `wp plugin install wordpress-importer --version=0.5 --force` + And these installed plugins: + """ + wordpress-importer --version=0.5 --force + """ And I run `wp plugin path wordpress-importer --dir` And save STDOUT as {PLUGIN_DIR} diff --git a/features/plugin.feature b/features/plugin.feature index 07dd97db..1053f0c5 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -303,8 +303,11 @@ Feature: Manage WordPress plugins Given a WP multisite install And I run `wp plugin delete --all` - When I run `wp plugin install debug-bar` - And I run `wp plugin install wordpress-importer --activate` + And these installed plugins: + """ + debug-bar + """ + When I run `wp plugin install wordpress-importer --activate` Then STDOUT should contain: """ Plugin 'wordpress-importer' activated. diff --git a/features/theme-auto-update-status.feature b/features/theme-auto-update-status.feature index 8c5f78ed..4fbbf7b3 100644 --- a/features/theme-auto-update-status.feature +++ b/features/theme-auto-update-status.feature @@ -3,9 +3,12 @@ Feature: Show the status of auto-updates for WordPress themes Background: Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install twentysixteen` - And I run `wp theme install twentyseventeen` - And I run `wp theme install twentynineteen` + And these installed themes: + """ + twentysixteen + twentyseventeen + twentynineteen + """ @require-wp-5.5 Scenario: Show an error if required params are missing diff --git a/features/theme-auto-updates-disable.feature b/features/theme-auto-updates-disable.feature index 54a09b03..00100080 100644 --- a/features/theme-auto-updates-disable.feature +++ b/features/theme-auto-updates-disable.feature @@ -3,9 +3,12 @@ Feature: Disable auto-updates for WordPress themes Background: Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install twentysixteen` - And I run `wp theme install twentyseventeen` - And I run `wp theme install twentynineteen` + And these installed themes: + """ + twentysixteen + twentyseventeen + twentynineteen + """ And I try `wp theme auto-updates enable --all` @require-wp-5.5 diff --git a/features/theme-auto-updates-enable.feature b/features/theme-auto-updates-enable.feature index c317a039..51817903 100644 --- a/features/theme-auto-updates-enable.feature +++ b/features/theme-auto-updates-enable.feature @@ -3,9 +3,12 @@ Feature: Enable auto-updates for WordPress themes Background: Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install twentysixteen` - And I run `wp theme install twentyseventeen` - And I run `wp theme install twentynineteen` + And these installed themes: + """ + twentysixteen + twentyseventeen + twentynineteen + """ And I try `wp theme auto-updates disable --all` @require-wp-5.5 diff --git a/features/theme-check-update.feature b/features/theme-check-update.feature index 9101c130..def8543a 100644 --- a/features/theme-check-update.feature +++ b/features/theme-check-update.feature @@ -3,7 +3,10 @@ Feature: Check for theme updates Scenario: Check for theme updates with no updates available Given a WP install - When I run `wp theme install twentytwelve --force` + And these installed themes: + """ + twentytwelve --force + """ # Ignore warnings if theme versions in trunk are newer than what's in the directory. # This is only a temporary situation before an impending release. And I try `wp theme update --all` diff --git a/features/theme-delete.feature b/features/theme-delete.feature index 1d9fa979..bbf7b645 100644 --- a/features/theme-delete.feature +++ b/features/theme-delete.feature @@ -3,8 +3,14 @@ Feature: Delete WordPress themes Background: Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install twentytwelve` - And I run `wp theme install twentyeleven --activate` + And these installed themes: + """ + twentytwelve + """ + And these installed and active themes: + """ + twentyeleven + """ Scenario: Delete an installed theme When I run `wp theme delete twentytwelve` @@ -58,7 +64,10 @@ Feature: Delete WordPress themes Scenario: Delete all installed themes when active theme has a parent Given a WP install - And I run `wp theme install oceanly-green --activate` + And these installed and active themes: + """ + oceanly-green + """ When I run `wp theme list --field=name` Then STDOUT should contain: diff --git a/features/theme-update.feature b/features/theme-update.feature index 20038036..3cd89a69 100644 --- a/features/theme-update.feature +++ b/features/theme-update.feature @@ -3,8 +3,11 @@ Feature: Update WordPress themes Scenario: Updating a theme with no version in the WordPress.org directory shouldn't delete the original theme Given a WP install - When I run `wp theme install twentytwelve --force` - And I run `wp scaffold child-theme wpclitesttheme --parent_theme=twentytwelve` + And these installed themes: + """ + twentytwelve --force + """ + When I run `wp scaffold child-theme wpclitesttheme --parent_theme=twentytwelve` Then the wp-content/themes/wpclitesttheme directory should exist When I try `wp theme update wpclitesttheme --version=100.0.0` @@ -50,7 +53,10 @@ Feature: Update WordPress themes """ # One theme installed. - Given I run `wp theme install storefront --version=1.0.0` + Given these installed themes: + """ + storefront --version=1.0.0 + """ When I try `wp theme update` Then the return code should be 1 @@ -86,7 +92,10 @@ Feature: Update WordPress themes """ # Two themes installed. - Given I run `wp theme install --force twentytwelve --version=1.0` + Given these installed themes: + """ + twentytwelve --version=1.0 --force + """ When I run `wp theme update --all` Then STDOUT should contain: @@ -125,7 +134,10 @@ Feature: Update WordPress themes Scenario: Update a theme to its latest minor release Given a WP install - And I run `wp theme install --force twentytwelve --version=3.0` + And these installed themes: + """ + twentytwelve --version=3.0 --force + """ When I run `wp theme update twentytwelve --minor` Then STDOUT should contain: @@ -141,7 +153,10 @@ Feature: Update WordPress themes Scenario: Update a theme to its latest patch release Given a WP install - And I run `wp theme install --force twentytwelve --version=1.1` + And these installed themes: + """ + twentytwelve --version=1.1 --force + """ When I run `wp theme update twentytwelve --patch` Then STDOUT should contain: @@ -260,7 +275,10 @@ Feature: Update WordPress themes Scenario: Skip theme update when theme directory is a VCS checkout Given a WP install - And I run `wp theme install twentytwelve --version=3.0 --force` + And these installed themes: + """ + twentytwelve --version=3.0 --force + """ And I run `wp theme path twentytwelve --dir` And save STDOUT as {THEME_DIR} @@ -278,7 +296,10 @@ Feature: Update WordPress themes Scenario: Update theme in VCS checkout when --include-vcs is set Given a WP install - And I run `wp theme install twentytwelve --version=3.0 --force` + And these installed themes: + """ + twentytwelve --version=3.0 --force + """ And I run `wp theme path twentytwelve --dir` And save STDOUT as {THEME_DIR} diff --git a/features/theme.feature b/features/theme.feature index a01e2135..be12e0fd 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -13,7 +13,10 @@ Feature: Manage WordPress themes Scenario: Installing and deleting theme Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install twentyeleven --activate` + And these installed and active themes: + """ + twentyeleven + """ When I run `wp theme install twentytwelve` Then STDOUT should not be empty @@ -72,8 +75,11 @@ Feature: Manage WordPress themes Scenario: Checking theme status without theme parameter Given a WP install - When I run `wp theme install classic --activate` - And I run `wp theme list --field=name --status=inactive | xargs wp theme delete` + And these installed and active themes: + """ + classic + """ + When I run `wp theme list --field=name --status=inactive | xargs wp theme delete` And I try `wp theme status` Then STDOUT should be: """ @@ -86,7 +92,10 @@ Feature: Manage WordPress themes Scenario: Install a theme, activate, then force install an older version of the theme Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install twentyeleven --activate` + And these installed and active themes: + """ + twentyeleven + """ When I run `wp theme install twentytwelve --version=1.4` Then STDOUT should not be empty @@ -143,7 +152,10 @@ Feature: Manage WordPress themes Scenario: Exclude theme from bulk updates. Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install twentyeleven --activate` + And these installed and active themes: + """ + twentyeleven + """ When I run `wp theme install twentytwelve --version=1.4 --force` Then STDOUT should contain: @@ -330,8 +342,11 @@ Feature: Manage WordPress themes @require-wp-5.7 Scenario: Enabling and disabling a theme Given a WP multisite install - And I run `wp theme install oceanly` - And I run `wp theme install oceanly-green` + And these installed themes: + """ + oceanly + oceanly-green + """ When I try `wp option get allowedthemes` Then the return code should be 1 @@ -426,7 +441,10 @@ Feature: Manage WordPress themes @require-wp-5.7 Scenario: Install and attempt to activate a child theme without its parent Given a WP install - And I run `wp theme install oceanly-green` + And these installed themes: + """ + oceanly-green + """ And I run `rm -rf wp-content/themes/oceanly` When I try `wp theme activate oceanly-green` @@ -440,8 +458,14 @@ Feature: Manage WordPress themes @require-wp-5.7 Scenario: List an active theme with its parent Given a WP install - And I run `wp theme install oceanly` - And I run `wp theme install --activate oceanly-green` + And these installed themes: + """ + oceanly + """ + And these installed and active themes: + """ + oceanly-green + """ # Hybrid_Registry throws warning for PHP 8+. When I try `wp theme list --fields=name,status` @@ -453,8 +477,11 @@ Feature: Manage WordPress themes @require-wp-5.7 Scenario: List broken themes (child theme without parent) Given a WP install - And I run `wp theme install oceanly` - And I run `wp theme install oceanly-green` + And these installed themes: + """ + oceanly + oceanly-green + """ When I run `wp theme list --fields=name,status` Then STDOUT should be a table containing rows: @@ -668,8 +695,14 @@ Feature: Manage WordPress themes Scenario: Parent theme is active when its child is active Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install twentytwelve` - And I run `wp theme install oceanly-green --activate` + And these installed themes: + """ + twentytwelve + """ + And these installed and active themes: + """ + oceanly-green + """ When I run `wp theme is-active oceanly-green` Then the return code should be 0 @@ -683,7 +716,10 @@ Feature: Manage WordPress themes Scenario: Excluding a missing theme should not throw an error Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install twentytwelve --version=1.5 --activate` + And these installed and active themes: + """ + twentytwelve --version=1.5 + """ And I run `wp theme update --all --exclude=missing-theme` Then STDERR should be empty And STDOUT should contain: @@ -868,8 +904,11 @@ Feature: Manage WordPress themes Scenario: Check theme type field for classic themes Given a WP install - When I run `wp theme install twentytwelve --force` - And I run `wp theme list --fields=name,type --name=twentytwelve` + And these installed themes: + """ + twentytwelve --force + """ + When I run `wp theme list --fields=name,type --name=twentytwelve` Then STDOUT should be a table containing rows: | name | type | | twentytwelve | classic | @@ -883,8 +922,14 @@ Feature: Manage WordPress themes Scenario: Filter theme list by multiple names Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install twentyeleven --activate` - And I run `wp theme install twentytwelve` + And these installed and active themes: + """ + twentyeleven + """ + And these installed themes: + """ + twentytwelve + """ When I run `wp theme list --name=twentytwelve,twentyeleven --fields=name,status` Then STDOUT should be a table containing rows: @@ -914,7 +959,10 @@ Feature: Manage WordPress themes @require-wp-5.5 Scenario: Flag themes whose version is higher than the one on WordPress.org without a request per theme Given a WP install - And I run `wp theme install twentytwelve --force` + And these installed themes: + """ + twentytwelve --force + """ And I run `sed -i.bak 's/^Version: .*/Version: 99.0/' wp-content/themes/twentytwelve/style.css` And a wp-content/themes/my-local-theme/style.css file: """