diff --git a/features/theme-list.feature b/features/theme-list.feature index 55e3b5e0..eab6a82d 100644 --- a/features/theme-list.feature +++ b/features/theme-list.feature @@ -3,32 +3,30 @@ Feature: List WordPress themes Scenario: Refresh update_themes transient when listing themes with --force-check flag Given a WP install And I run `wp theme delete --all --force` - And I run `wp theme install --force twentytwentyfour --version=1.1` + And I run `wp theme install --force twentytwelve --version=4.2` And a update-transient.php file: """ response['twentytwentyfour'] = (object) array( - 'theme' => 'twentytwentyfour', + $transient->response['twentytwelve'] = (object) array( + 'theme' => 'twentytwelve', 'new_version' => '100.0.0', - 'url' => 'https://wordpress.org/themes/twentytwentyfour/', - 'package' => 'https://downloads.wordpress.org/theme/twentytwentyfour.100.zip', - 'requires' => '6.4', - 'requires_php' => '7.0' + 'url' => 'https://wordpress.org/themes/twentytwelve/', + 'package' => 'https://downloads.wordpress.org/theme/twentytwelve.100.zip' ); $transient->checked = array( - 'twentytwentyfour' => '1.1', + 'twentytwelve' => '4.2', ); - unset( $transient->no_update['twentytwentyfour'] ); + unset( $transient->no_update['twentytwelve'] ); set_site_transient( 'update_themes', $transient ); WP_CLI::success( 'Transient updated.' ); """ # Populates the initial transient in the database - When I run `wp theme list --fields=name,status,update` + When I run `wp theme list --fields=name,update` Then STDOUT should be a table containing rows: - | name | status | update | - | twentytwentyfour | active | none | + | name | update | + | twentytwelve | none | # Modify the transient in the database to simulate an update When I run `wp eval-file update-transient.php` @@ -38,22 +36,22 @@ Feature: List WordPress themes """ # Verify the fake transient value produces the expected output - When I run `wp theme list --fields=name,status,update` + When I run `wp theme list --fields=name,update` Then STDOUT should be a table containing rows: - | name | status | update | - | twentytwentyfour | active | available | + | name | update | + | twentytwelve | available | # Repeating the same command again should produce the same results - When I run `wp theme list --fields=name,status,update` + When I run the previous command again Then STDOUT should be a table containing rows: - | name | status | update | - | twentytwentyfour | active | available | + | name | update | + | twentytwelve | available | # Using the --force-check flag should refresh the transient back to the original value - When I run `wp theme list --fields=name,status,update --force-check` + When I run `wp theme list --fields=name,update --force-check` Then STDOUT should be a table containing rows: - | name | status | update | - | twentytwentyfour | active | none | + | name | update | + | twentytwelve | none | When I try `wp theme list --skip-update-check --force-check` Then STDERR should contain: diff --git a/src/Plugin_Command.php b/src/Plugin_Command.php index 17c0c36b..a6d1ba32 100644 --- a/src/Plugin_Command.php +++ b/src/Plugin_Command.php @@ -1327,7 +1327,7 @@ public function delete( $args, $assoc_args = array() ) { * * [--force-check] * : Bypass the transient cache and force a fresh update check. - * + * * [--recently-active] * : If set, only recently active plugins will be shown and the status filter will be ignored. * diff --git a/src/WP_CLI/CommandWithUpgrade.php b/src/WP_CLI/CommandWithUpgrade.php index 50a3dc63..708ad9d8 100755 --- a/src/WP_CLI/CommandWithUpgrade.php +++ b/src/WP_CLI/CommandWithUpgrade.php @@ -533,8 +533,8 @@ static function ( $result ) { protected function _list( $_, $assoc_args ) { // If `--force-check` and `--skip-update-check` flags are both present, abort. - if ( true === (bool) Utils\get_flag_value( $assoc_args, 'force-check', false ) and true === (bool) Utils\get_flag_value( $assoc_args, 'skip-update-check', false ) ) { - WP_CLI::error("{$this->item_type} updates cannot be both force-checked and skipped. Choose one."); + if ( true === (bool) Utils\get_flag_value( $assoc_args, 'force-check', false ) && true === (bool) Utils\get_flag_value( $assoc_args, 'skip-update-check', false ) ) { + WP_CLI::error( "{$this->item_type} updates cannot be both force-checked and skipped. Choose one." ); } // If `--force-check` flag is present, delete the upgrade transient.