OSDN Git Service

'wp theme delete' should not delete active theme
authorRodrigo Primo <rodrigo@hacklab.com.br>
Fri, 15 Nov 2013 15:18:52 +0000 (13:18 -0200)
committerRodrigo Primo <rodrigo@hacklab.com.br>
Fri, 15 Nov 2013 15:18:52 +0000 (13:18 -0200)
features/theme.feature
php/commands/theme.php

index 7898f9d..121c2c3 100644 (file)
@@ -73,3 +73,33 @@ Feature: Manage WordPress themes
        """
        wp-content/themes/p2
        """
+
+  Scenario: Deleting a theme
+    When I run `wp theme install p2`
+    Then STDOUT should not be empty
+  
+    When I try `wp theme delete invalid-theme`
+    Then STDERR should contain:
+      """
+      Warning: The 'invalid-theme' theme could not be found.
+      """
+    And STDOUT should be empty
+
+    When I run `wp theme delete p2`
+    Then STDOUT should be:
+      """
+      Success: Deleted 'p2' theme.
+      """
+    And STDERR should be empty
+    
+    When I run `wp theme install p2 --activate`
+    Then STDOUT should not be empty
+    
+    When I try `wp theme delete p2`
+    Then STDERR should be:
+      """
+      Warning: Can't delete the currently active theme: p2
+      """
+    And STDOUT should be empty
+    
+    
\ No newline at end of file
index 87c806c..3cfdfae 100644 (file)
@@ -359,6 +359,7 @@ class Theme_Command extends \WP_CLI\CommandWithUpgrade {
 
                        if ( $this->is_active_theme( $theme ) ) {
                                WP_CLI::warning( "Can't delete the currently active theme: $theme_slug" );
+                               continue;
                        }
 
                        $r = delete_theme( $theme_slug );