Skip to content

Commit da807cf

Browse files
authored
Merge pull request #19 from wp-cli/18-fix-phpunit-version-fetching
Fix fetching the VERSION file from the framework
2 parents 894c765 + f8a0544 commit da807cf

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/bootstrap.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,19 @@
66
? WP_CLI_TESTS_ROOT . '/vendor'
77
: WP_CLI_TESTS_ROOT . '/../..'
88
);
9-
define( 'WP_CLI_ROOT', VENDOR_DIR . '/wp-cli/wp-cli' );
109
define( 'PACKAGE_ROOT', VENDOR_DIR . '/..' );
11-
define( 'WP_CLI_VERSION', trim( file_get_contents( WP_CLI_ROOT . '/VERSION' ) ) );
10+
11+
define( 'WP_CLI_ROOT',
12+
is_readable( PACKAGE_ROOT . '/VERSION' )
13+
? PACKAGE_ROOT
14+
: VENDOR_DIR . '/wp-cli/wp-cli'
15+
);
16+
17+
define( 'WP_CLI_VERSION',
18+
is_readable( WP_CLI_ROOT . '/VERSION' )
19+
? trim( file_get_contents( WP_CLI_ROOT . '/VERSION' ) )
20+
: define( 'WP_CLI_VERSION', '2.x.x' )
21+
);
1222

1323
/**
1424
* Compatibility with PHPUnit 6+

0 commit comments

Comments
 (0)