-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from wp-cli/fix/126-check-behat-config
- Loading branch information
Showing
2 changed files
with
22 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,20 @@ | ||
#!/bin/bash | ||
|
||
# Run the Behat tests only if a features folder exists | ||
if [ ! -d "features" ]; then | ||
exit 0; | ||
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 Behat root folder, we start with this scripts location | ||
# To retrieve the WP-CLI tests package root folder, we start with this scripts | ||
# location. | ||
SOURCE="${BASH_SOURCE[0]}" | ||
|
||
# Resolve $SOURCE until the file is no longer a symlink | ||
# Resolve $SOURCE until the file is no longer a symlink. | ||
while [ -h "$SOURCE" ]; do | ||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | ||
SOURCE="$(readlink "$SOURCE")" | ||
# If $SOURCE was a relative symlink, we need to resolve it relative to the | ||
# path where the symlink file was located | ||
# path where the symlink file was located. | ||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" | ||
done | ||
|
||
# Fetch the root folder of the Behat package | ||
BEHAT_ROOT="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" | ||
export BEHAT_ROOT | ||
|
||
# Set Behat environment variables | ||
BEHAT_PARAMS="{\"suites\":{\"default\":{\"contexts\":[\"WP_CLI\\\\Tests\\\\Context\\\\FeatureContext\"],\"paths\":[\"features\"]}}}" | ||
export BEHAT_PARAMS | ||
|
||
# Generate the tags to apply environment-specific filters | ||
BEHAT_TAGS=$(php "$BEHAT_ROOT"/utils/behat-tags.php) | ||
# Fetch the root folder of the WP-CLI tests package. | ||
WP_CLI_TESTS_ROOT="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" | ||
export WP_CLI_TESTS_ROOT | ||
|
||
# Run the functional tests | ||
vendor/bin/behat --format progress "$BEHAT_TAGS" --strict --rerun "$@" | ||
"$WP_CLI_TESTS_ROOT"/bin/run-behat-tests --rerun "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters