Skip to content

Commit 755bfaa

Browse files
Merge pull request #3392 from wp-cli/3383-fix-no-version
Fix Exception in test suite when no `WP_VERSION` is provided
2 parents d7b869e + 93ee0a1 commit 755bfaa

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

ci/prepare.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,5 @@ echo $CLI_VERSION > PHAR_BUILD_VERSION
3030
# Install CodeSniffer things
3131
./ci/prepare-codesniffer.sh
3232

33-
./bin/wp core download --version=$WP_VERSION --path='/tmp/wp-cli-test core-download-cache/'
34-
35-
./bin/wp core version --path='/tmp/wp-cli-test core-download-cache/'
36-
3733
mysql -e 'CREATE DATABASE wp_cli_test;' -uroot
3834
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"localhost" IDENTIFIED BY "password1"' -uroot

features/bootstrap/FeatureContext.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ private static function cache_wp_files() {
7777
if ( is_readable( self::$cache_dir . '/wp-config-sample.php' ) )
7878
return;
7979

80-
$version = getenv( 'WP_VERSION' ) ? '--version=' . getenv( 'WP_VERSION' ) : '';
81-
$cmd = Utils\esc_cmd( 'wp core download --force --path=%s %s', self::$cache_dir, $version );
80+
$cmd = Utils\esc_cmd( 'wp core download --force --path=%s', self::$cache_dir );
81+
if ( getenv( 'WP_VERSION' ) ) {
82+
$cmd .= Utils\esc_cmd( ' --version=%s', getenv( 'WP_VERSION' ) );
83+
}
8284
Process::create( $cmd, null, self::get_process_env_variables() )->run_check();
8385
}
8486

@@ -91,6 +93,9 @@ public static function prepare( SuiteEvent $event ) {
9193
echo $result->stdout;
9294
echo PHP_EOL;
9395
self::cache_wp_files();
96+
$result = Process::create( Utils\esc_cmd( 'wp core version --path=%s', self::$cache_dir ) , null, self::get_process_env_variables() )->run_check();
97+
echo 'WordPress ' . $result->stdout;
98+
echo PHP_EOL;
9499
}
95100

96101
/**

0 commit comments

Comments
 (0)