@@ -660,14 +660,6 @@ public static function prepare( BeforeSuiteScope $scope ): void {
660660 $ result = Process::create ( 'wp cli info ' , null , self ::get_process_env_variables () )->run_check ();
661661 echo "{$ result ->stdout }\n" ;
662662
663- self ::cache_wp_files ();
664-
665- $ result = Process::create ( Utils \esc_cmd ( 'wp core version --debug --path=%s ' , self ::$ cache_dir ), null , self ::get_process_env_variables () )->run_check ();
666- echo "[Debug messages] \n" ;
667- echo "{$ result ->stderr }\n" ;
668-
669- echo "WordPress {$ result ->stdout }\n" ;
670-
671663 // Remove install cache if any (not setting the static var).
672664 $ wp_version = getenv ( 'WP_VERSION ' );
673665 $ wp_version_suffix = ( false !== $ wp_version ) ? "- $ wp_version " : '' ;
@@ -1298,6 +1290,16 @@ public function add_line_to_wp_config( &$wp_config_code, $line ): void {
12981290 * @param string $subdir
12991291 */
13001292 public function download_wp ( $ subdir = '' ): void {
1293+ if ( ! self ::$ cache_dir ) {
1294+ self ::cache_wp_files ();
1295+
1296+ $ result = Process::create ( Utils \esc_cmd ( 'wp core version --debug --path=%s ' , self ::$ cache_dir ), null , self ::get_process_env_variables () )->run_check ();
1297+ echo "[Debug messages] \n" ;
1298+ echo "{$ result ->stderr }\n" ;
1299+
1300+ echo "WordPress {$ result ->stdout }\n" ;
1301+ }
1302+
13011303 $ dest_dir = $ this ->variables ['RUN_DIR ' ] . "/ $ subdir " ;
13021304
13031305 if ( $ subdir ) {
0 commit comments