OSDN Git Service

check response from _parse_name()
authorscribu <mail@scribu.net>
Fri, 4 Oct 2013 12:24:37 +0000 (14:24 +0200)
committerscribu <mail@scribu.net>
Fri, 4 Oct 2013 12:24:37 +0000 (14:24 +0200)
features/upgradables.feature
php/commands/plugin.php

index 56ee10d..4a21f41 100644 (file)
@@ -8,6 +8,10 @@ Feature: Manage WordPress themes and plugins
     And I run `wp <type> path`
     And save STDOUT as {CONTENT_DIR}
 
+    When I try `wp <type> get <item>`
+    Then the return code should be 1
+    And STDERR should not be empty
+
     # Install an out of date <item> from WordPress.org repository
     When I run `wp <type> install <item> --version=<version>`
     Then STDOUT should contain:
index b257689..4686b5f 100644 (file)
@@ -388,6 +388,9 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade {
         */
        public function get( $args, $assoc_args ) {
                $file = $this->_parse_name( $args[0] );
+               if ( !$file ) {
+                       WP_CLI::error( "The '{$args[0]}' plugin could not be found." );
+               }
 
                $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $file, false, false );