Skip to content

Commit 07282aa

Browse files
Copilotswissspidy
andcommitted
Update ExtensionUpgraderSkin to properly handle themes and add theme update test
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent e2f819f commit 07282aa

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

features/theme-update.feature

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,25 @@ Feature: Update WordPress themes
154154
"""
155155
1.1.1
156156
"""
157+
158+
@require-wp-4.5
159+
Scenario: Updating all themes should show the name of each theme as it is updated
160+
Given a WP install
161+
And I run `wp theme delete --all --force`
162+
163+
When I run `wp theme install moina --version=1.0.2`
164+
Then STDOUT should not be empty
165+
166+
When I run `wp theme install twentytwelve --version=1.0`
167+
Then STDOUT should not be empty
168+
169+
When I try `wp theme update --all`
170+
Then STDOUT should contain:
171+
"""
172+
Updating Moina...
173+
"""
174+
175+
And STDOUT should contain:
176+
"""
177+
Success: Updated 2 of 2 themes.
178+
"""

src/WP_CLI/ExtensionUpgraderSkin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class ExtensionUpgraderSkin extends UpgraderSkin {
1717
public function before() {
1818
if ( isset( $this->plugin_info ) && is_array( $this->plugin_info ) && isset( $this->plugin_info['Name'] ) ) {
1919
WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->plugin_info['Name'], ENT_QUOTES, get_bloginfo( 'charset' ) ) ) );
20-
} elseif ( isset( $this->theme_info ) && is_array( $this->theme_info ) && isset( $this->theme_info['Name'] ) ) {
21-
WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->theme_info['Name'], ENT_QUOTES, get_bloginfo( 'charset' ) ) ) );
20+
} elseif ( isset( $this->theme_info ) && is_object( $this->theme_info ) && method_exists( $this->theme_info, 'get' ) ) {
21+
WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->theme_info->get( 'Name' ), ENT_QUOTES, get_bloginfo( 'charset' ) ) ) );
2222
}
2323
}
2424
}

0 commit comments

Comments
 (0)