Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions features/checksum-core.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 24 additions & 0 deletions features/checksum-plugin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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\)\./
2 changes: 1 addition & 1 deletion src/Checksum_Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/Checksum_Plugin_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading