-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathrun-behat-tests
More file actions
executable file
·49 lines (39 loc) · 1.45 KB
/
run-behat-tests
File metadata and controls
executable file
·49 lines (39 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Run the Behat tests only if a Behat config file is found.
if [ ! -f "behat.yml" ]; then
echo 'Did not detect "behat.yml" file, skipping Behat tests.'
exit 0;
fi
if ! command -v jq &> /dev/null
then
echo 'The required "jq" command was not found, please install it to run the Behat tests.'
echo "See https://stedolan.github.io/jq/download/ for installation instructions."
exit 1;
fi
if [[ "$@" == *"--help"* ]]; then
vendor/bin/behat "$@"
ret=$?
exit $ret
fi
# 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.
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.
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
# Fetch the root folder of the WP-CLI tests package.
WP_CLI_TESTS_ROOT="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
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 "$@"