From 7658e9189b10bc364ff71600273185e6fde6d0d4 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Wed, 3 Mar 2021 18:10:31 +0000 Subject: [PATCH] Add missing import for Requests --- src/Context/FeatureContext.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Context/FeatureContext.php b/src/Context/FeatureContext.php index 4e37eda6a..b0e4db777 100644 --- a/src/Context/FeatureContext.php +++ b/src/Context/FeatureContext.php @@ -7,6 +7,8 @@ use Behat\Behat\Hook\Scope\BeforeScenarioScope; use Behat\Testwork\Hook\Scope\AfterSuiteScope; use Behat\Testwork\Hook\Scope\BeforeSuiteScope; +use Requests; +use RuntimeException; use WP_CLI\Process; use WP_CLI\Utils; @@ -827,10 +829,10 @@ public function create_config( $subdir = '', $extra_php = false ) { $params['extra-php'] = $extra_php; } + $run_dir = '' !== $subdir ? ( $this->variables['RUN_DIR'] . "/$subdir" ) : $this->variables['RUN_DIR']; $config_cache_path = ''; if ( self::$install_cache_dir ) { $config_cache_path = self::$install_cache_dir . '/config_' . md5( implode( ':', $params ) . ':subdir=' . $subdir ); - $run_dir = '' !== $subdir ? ( $this->variables['RUN_DIR'] . "/$subdir" ) : $this->variables['RUN_DIR']; } 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 ) { $files = scandir( $upd_dir ); if ( false === $files ) { $error = error_get_last(); - throw new \RuntimeException( sprintf( "Failed to open updated directory '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_dir, $error['message'] ) ); + throw new RuntimeException( sprintf( "Failed to open updated directory '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_dir, $error['message'] ) ); } foreach ( array_diff( $files, array( '.', '..' ) ) as $file ) { $upd_file = $upd_dir . '/' . $file; @@ -1051,13 +1053,13 @@ private static function dir_diff_copy( $upd_dir, $src_dir, $cop_dir ) { if ( is_dir( $upd_file ) ) { if ( ! file_exists( $cop_file ) && ! mkdir( $cop_file, 0777, true /*recursive*/ ) ) { $error = error_get_last(); - throw new \RuntimeException( sprintf( "Failed to create copy directory '%s': %s. " . __FILE__ . ':' . __LINE__, $cop_file, $error['message'] ) ); + throw new RuntimeException( sprintf( "Failed to create copy directory '%s': %s. " . __FILE__ . ':' . __LINE__, $cop_file, $error['message'] ) ); } self::copy_dir( $upd_file, $cop_file ); } else { if ( ! copy( $upd_file, $cop_file ) ) { $error = error_get_last(); - throw new \RuntimeException( sprintf( "Failed to copy '%s' to '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_file, $cop_file, $error['message'] ) ); + throw new RuntimeException( sprintf( "Failed to copy '%s' to '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_file, $cop_file, $error['message'] ) ); } } } elseif ( is_dir( $upd_file ) ) {