Skip to content

Commit a673313

Browse files
authored
Merge pull request #144 from wp-cli/patch-cache-dir
cache the wp to the specific directory
2 parents 5a6707f + 9dcc1f4 commit a673313

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

features/bootstrap/FeatureContext.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,13 @@ private static function get_process_env_variables() {
7575
// We cache the results of `wp core download` to improve test performance
7676
// Ideally, we'd cache at the HTTP layer for more reliable tests
7777
private static function cache_wp_files() {
78-
self::$cache_dir = sys_get_temp_dir() . '/wp-cli-test core-download-cache';
79-
78+
$wp_version_suffix = ( $wp_version = getenv( 'WP_VERSION' ) ) ? "-$wp_version" : '';
79+
self::$cache_dir = sys_get_temp_dir() . '/wp-cli-test-core-download-cache' . $wp_version_suffix;
8080
if ( is_readable( self::$cache_dir . '/wp-config-sample.php' ) )
8181
return;
82-
8382
$cmd = Utils\esc_cmd( 'wp core download --force --path=%s', self::$cache_dir );
84-
if ( getenv( 'WP_VERSION' ) ) {
85-
$cmd .= Utils\esc_cmd( ' --version=%s', getenv( 'WP_VERSION' ) );
83+
if ( $wp_version ) {
84+
$cmd .= Utils\esc_cmd( ' --version=%s', $wp_version );
8685
}
8786
Process::create( $cmd, null, self::get_process_env_variables() )->run_check();
8887
}

0 commit comments

Comments
 (0)