Last active
December 13, 2023 00:01
-
-
Save gardenboi/36d687d280a8ad668bf4483dbe08ca98 to your computer and use it in GitHub Desktop.
Execute install-wp-tests.sh in a VVV machine for PHPUnit testing
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
#!/bin/bash | |
#Get the args with or default | |
SKIP_DB_CREATION=${1:-false} | |
DB_USER=${2:-root} | |
DB_PASS=${3:-root} | |
DB_NAME=${4:-cf7a_tests} | |
DB_HOST=${5:-127.0.0.1} | |
WP_VERSION=${6:-latest} | |
# Whoareyou | |
current_username=$(whoami) | |
# Get the directory of the current script | |
script_dir=$(dirname "$(realpath "$0")") | |
# Substitute the local path with the vagrant path | |
srv_path=$(echo "$script_dir" | sed "s|/home/$current_username/vvv-local|/srv|g") | |
# Call vagrant ssh with the new path | |
vagrant ssh -t -c "chmod +x $srv_path/install-wp-tests.sh && $srv_path/install-wp-tests.sh $DB_NAME $DB_USER $DB_PASS $DB_HOST $WP_VERSION $SKIP_DB_CREATION" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the args are all default, if you're using this as a prescript set the first arg to True to not attempt to create the db all the time,
this script is intend to work with the wordpress-test-template