OSDN Git Service

allow WP-CLI to be invoked from subdirectories other than the subdir the WP files...
authorscribu <mail@scribu.net>
Fri, 31 Jan 2014 00:09:45 +0000 (02:09 +0200)
committerscribu <mail@scribu.net>
Fri, 31 Jan 2014 00:13:57 +0000 (02:13 +0200)
features/config.feature
php/WP_CLI/Runner.php

index 86294e9..f3021ec 100644 (file)
@@ -54,6 +54,10 @@ Feature: Have a config file
     When I run `wp core is-installed` from 'core/wp-content'
     Then STDOUT should be empty
 
+    When I run `mkdir -p other/subdir`
+    And I run `wp core is-installed` from 'other/subdir'
+    Then STDOUT should be empty
+
   Scenario: WP in a subdirectory (autodetected)
     Given a WP install in 'core'
 
@@ -71,6 +75,10 @@ Feature: Have a config file
     When I run `wp core is-installed`
     Then STDOUT should be empty
 
+    When I run `mkdir -p other/subdir`
+    And I run `wp core is-installed` from 'other/subdir'
+    Then STDOUT should be empty
+
   Scenario: Nested installs
     Given a WP install
     And a WP install in 'subsite'
index b4823e1..6abb09a 100644 (file)
@@ -119,7 +119,7 @@ class Runner {
                        return dirname( $wp_load_path );
                }
 
-               return self::extract_subdir_path( getcwd() . '/index.php' );
+               return self::extract_subdir_path( Utils\find_file_upward( 'index.php' ) );
        }
 
        private static function set_wp_root( $path ) {