From 13788bcd3fc91e4770b727602f8c81908d020812 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Thu, 23 Aug 2018 17:38:03 +0200 Subject: [PATCH] Fix fetching the VERSION file from the framework --- tests/bootstrap.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 4ca616f29..b4119cb3e 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -6,9 +6,19 @@ ? WP_CLI_TESTS_ROOT . '/vendor' : WP_CLI_TESTS_ROOT . '/../..' ); -define( 'WP_CLI_ROOT', VENDOR_DIR . '/wp-cli/wp-cli' ); define( 'PACKAGE_ROOT', VENDOR_DIR . '/..' ); -define( 'WP_CLI_VERSION', trim( file_get_contents( WP_CLI_ROOT . '/VERSION' ) ) ); + +define( 'WP_CLI_ROOT', + is_readable( PACKAGE_ROOT . '/VERSION' ) + ? PACKAGE_ROOT + : VENDOR_DIR . '/wp-cli/wp-cli' +); + +define( 'WP_CLI_VERSION', + is_readable( WP_CLI_ROOT . '/VERSION' ) + ? trim( file_get_contents( WP_CLI_ROOT . '/VERSION' ) ) + : define( 'WP_CLI_VERSION', '2.x.x' ) +); /** * Compatibility with PHPUnit 6+