diff --git a/bin/run-behat-tests b/bin/run-behat-tests index f9a09bc1..6002793b 100755 --- a/bin/run-behat-tests +++ b/bin/run-behat-tests @@ -19,11 +19,6 @@ if [[ "$@" == *"--help"* ]]; then exit $ret fi -# Turn WP_VERSION into an actual number to make sure our tags work correctly. -if [ "${WP_VERSION-latest}" = "latest" ]; then - export WP_VERSION=$(curl -s https://api.wordpress.org/core/version-check/1.7/ | jq -r ".offers[0].current") -fi - # To retrieve the WP-CLI tests package root folder, we start with this scripts # location. SOURCE="${BASH_SOURCE[0]}" @@ -44,5 +39,11 @@ export WP_CLI_TESTS_ROOT # Generate the tags to apply environment-specific filters. BEHAT_TAGS=$(php "$WP_CLI_TESTS_ROOT"/utils/behat-tags.php) +# Resolve WP_VERSION. +WP_VERSION=$(php "$WP_CLI_TESTS_ROOT"/utils/wp-version-resolver.php) +export WP_VERSION + +echo "Running Behat tests for WordPress $WP_VERSION" + # Run the functional tests. vendor/bin/behat --format progress "$BEHAT_TAGS" --strict "$@" diff --git a/composer.json b/composer.json index 05b17a43..0e3e8e6d 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "require": { "php": ">=5.6", "behat/behat": "^3.7", + "composer/semver": "^3.4", "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || ^0.5 || ^0.6.2 || ^0.7.1 || ^1.0.0", "php-parallel-lint/php-console-highlighter": "^1.0", "php-parallel-lint/php-parallel-lint": "^1.3.1", diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 62a1a672..4b69e816 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -63,9 +63,11 @@ so this file does not have to comply with WP naming conventions. --> */utils/behat-tags\.php$ + */utils/wp-version-resolver\.php$ */utils/behat-tags\.php$ + */utils/wp-version-resolver\.php$