diff --git a/features/checksum-core.feature b/features/checksum-core.feature index 665d98cf..7f41d193 100644 --- a/features/checksum-core.feature +++ b/features/checksum-core.feature @@ -312,3 +312,19 @@ Feature: Validate checksums for WordPress install Success: WordPress installation verifies against checksums. """ And the return code should be 0 + + Scenario: Verify core checksums with excluded files containing spaces + Given a WP install + And "WordPress" replaced with "PressWord" in the readme.html file + And a wp-includes/some-filename.php file: + """ + sample content of some file + """ + + When I try `wp core verify-checksums --exclude='readme.html, wp-includes/some-filename.php'` + Then STDERR should be empty + And STDOUT should be: + """ + Success: WordPress installation verifies against checksums. + """ + And the return code should be 0 diff --git a/features/checksum-plugin.feature b/features/checksum-plugin.feature index 98920c6f..acc65d20 100644 --- a/features/checksum-plugin.feature +++ b/features/checksum-plugin.feature @@ -291,3 +291,27 @@ Feature: Validate checksums for WordPress plugins Warning: Must-use plugin 'custom-mu-plugin.php' appears to be a custom file or loader plugin and cannot be verified. """ And STDOUT should match /Success: Verified \d of \d plugins \(\d skipped\)\./ + + Scenario: Plugin verification is skipped when the --exclude argument contains spaces + Given a WP install + + When I run `wp plugin delete --all` + Then STDOUT should contain: + """ + Success: + """ + + When I run `wp plugin install akismet --ignore-requirements` + Then STDOUT should contain: + """ + Success: + """ + + When I run `wp plugin install duplicate-post --version=3.2.1 --ignore-requirements` + Then STDOUT should contain: + """ + Success: + """ + + When I try `wp plugin verify-checksums --all --exclude='akismet, duplicate-post'` + Then STDOUT should match /^Success: Verified \d of \d plugins \(\d skipped\)\./ diff --git a/src/Checksum_Core_Command.php b/src/Checksum_Core_Command.php index 8bca3518..5a956327 100644 --- a/src/Checksum_Core_Command.php +++ b/src/Checksum_Core_Command.php @@ -126,7 +126,7 @@ public function __invoke( $args, $assoc_args ) { if ( ! empty( $assoc_args['exclude'] ) ) { $exclude = Utils\get_flag_value( $assoc_args, 'exclude', '' ); - $this->exclude_files = explode( ',', $exclude ); + $this->exclude_files = array_map( 'trim', explode( ',', $exclude ) ); } if ( empty( $wp_version ) ) { diff --git a/src/Checksum_Plugin_Command.php b/src/Checksum_Plugin_Command.php index cf3f38f2..048be108 100644 --- a/src/Checksum_Plugin_Command.php +++ b/src/Checksum_Plugin_Command.php @@ -103,7 +103,7 @@ public function __invoke( $args, $assoc_args ) { WP_CLI::error( 'You need to specify either one or more plugin slugs to check or use the --all flag to check all plugins.' ); } - $exclude_list = explode( ',', $exclude ); + $exclude_list = array_map( 'trim', explode( ',', $exclude ) ); $skips = 0;