Skip to content

Commit 7c1e9ad

Browse files
authored
Merge pull request #105 from wp-cli/fix/missing-requests-import
Add missing import for `Requests`
2 parents a64219e + 7658e91 commit 7c1e9ad

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Context/FeatureContext.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
88
use Behat\Testwork\Hook\Scope\AfterSuiteScope;
99
use Behat\Testwork\Hook\Scope\BeforeSuiteScope;
10+
use Requests;
11+
use RuntimeException;
1012
use WP_CLI\Process;
1113
use WP_CLI\Utils;
1214

@@ -827,10 +829,10 @@ public function create_config( $subdir = '', $extra_php = false ) {
827829
$params['extra-php'] = $extra_php;
828830
}
829831

832+
$run_dir = '' !== $subdir ? ( $this->variables['RUN_DIR'] . "/$subdir" ) : $this->variables['RUN_DIR'];
830833
$config_cache_path = '';
831834
if ( self::$install_cache_dir ) {
832835
$config_cache_path = self::$install_cache_dir . '/config_' . md5( implode( ':', $params ) . ':subdir=' . $subdir );
833-
$run_dir = '' !== $subdir ? ( $this->variables['RUN_DIR'] . "/$subdir" ) : $this->variables['RUN_DIR'];
834836
}
835837

836838
if ( $config_cache_path && file_exists( $config_cache_path ) ) {
@@ -1041,7 +1043,7 @@ private static function dir_diff_copy( $upd_dir, $src_dir, $cop_dir ) {
10411043
$files = scandir( $upd_dir );
10421044
if ( false === $files ) {
10431045
$error = error_get_last();
1044-
throw new \RuntimeException( sprintf( "Failed to open updated directory '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_dir, $error['message'] ) );
1046+
throw new RuntimeException( sprintf( "Failed to open updated directory '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_dir, $error['message'] ) );
10451047
}
10461048
foreach ( array_diff( $files, array( '.', '..' ) ) as $file ) {
10471049
$upd_file = $upd_dir . '/' . $file;
@@ -1051,13 +1053,13 @@ private static function dir_diff_copy( $upd_dir, $src_dir, $cop_dir ) {
10511053
if ( is_dir( $upd_file ) ) {
10521054
if ( ! file_exists( $cop_file ) && ! mkdir( $cop_file, 0777, true /*recursive*/ ) ) {
10531055
$error = error_get_last();
1054-
throw new \RuntimeException( sprintf( "Failed to create copy directory '%s': %s. " . __FILE__ . ':' . __LINE__, $cop_file, $error['message'] ) );
1056+
throw new RuntimeException( sprintf( "Failed to create copy directory '%s': %s. " . __FILE__ . ':' . __LINE__, $cop_file, $error['message'] ) );
10551057
}
10561058
self::copy_dir( $upd_file, $cop_file );
10571059
} else {
10581060
if ( ! copy( $upd_file, $cop_file ) ) {
10591061
$error = error_get_last();
1060-
throw new \RuntimeException( sprintf( "Failed to copy '%s' to '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_file, $cop_file, $error['message'] ) );
1062+
throw new RuntimeException( sprintf( "Failed to copy '%s' to '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_file, $cop_file, $error['message'] ) );
10611063
}
10621064
}
10631065
} elseif ( is_dir( $upd_file ) ) {

0 commit comments

Comments
 (0)