OSDN Git Service

exit with an error when 'wp site url' is called on a non-multisite install
authorRodrigo Primo <rodrigo@hacklab.com.br>
Fri, 20 Dec 2013 10:38:48 +0000 (08:38 -0200)
committerRodrigo Primo <rodrigo@hacklab.com.br>
Fri, 20 Dec 2013 10:38:48 +0000 (08:38 -0200)
features/site.feature
php/commands/site.php

index da4c2cb..26f7678 100644 (file)
@@ -50,6 +50,12 @@ Feature: Manage sites in a multisite installation
   Scenario: Empty a site
     Given a WP install
 
+    When I try `wp site url 1`
+    Then STDERR should be:
+      """
+      Error: This is not a multisite install.
+      """
+
     When I run `wp post create --post_title='Test post' --post_content='Test content.' --porcelain`
     Then STDOUT should not be empty
 
index 79eb8d9..14ef186 100644 (file)
@@ -402,6 +402,10 @@ class Site_Command extends \WP_CLI\CommandWithDBObject {
         *     wp site url 123
         */
        public function url( $args ) {
+               if ( !is_multisite() ) {
+                       WP_CLI::error( 'This is not a multisite install.' );
+               }
+
                parent::_url( $args, 'get_site_url' );
        }
 }