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
12 changes: 11 additions & 1 deletion features/core-download.feature
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Feature: Download WordPress
Scenario: Catch download of non-existent WP version
Given an empty directory

When I try `wp core download --version=4.1.0 --force`
When I try `wp core download --version=1.0.3 --force`
Then STDERR should contain:
"""
Error: Release not found.
Expand Down Expand Up @@ -473,3 +473,13 @@ Feature: Download WordPress
Error: Cannot use both --skip-content and --no-extract at the same time.
"""
And the return code should be 1

Scenario: Allow installing major version with trailing zero
Given an empty directory

When I run `wp core download --version=6.7.0`
Then STDOUT should contain:
"""
Success:
"""

11 changes: 11 additions & 0 deletions features/core-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,14 @@ Feature: Update WordPress core
"""
Using cached
"""

Scenario: Allow installing major version with trailing zero
Given a WP install

When I run `wp core update --version=6.2.0 --force`
Then STDOUT should contain:
"""
Success:
"""


4 changes: 4 additions & 0 deletions src/Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,10 @@ private function get_download_url( $version, $locale = 'en_US', $file_type = 'zi

$locale_subdomain = 'en_US' === $locale ? '' : substr( $locale, 0, 2 ) . '.';
$locale_suffix = 'en_US' === $locale ? '' : "-{$locale}";
// Match 6.7.0 but not 6.0
if ( substr_count( $version, '.' ) > 1 && substr( $version, -2 ) === '.0' ) {
$version = substr( $version, 0, -2 );
}

return "https://{$locale_subdomain}wordpress.org/wordpress-{$version}{$locale_suffix}.{$file_type}";
}
Expand Down
Loading