Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
- update install-test-env.sh
Browse files Browse the repository at this point in the history
- add .env.dist
  • Loading branch information
jasonbahl committed Jul 19, 2021
1 parent 0302f68 commit e88ef9c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
31 changes: 31 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
DB_NAME=wordpress
DB_HOST=app_db
DB_USER=wordpress
DB_PASSWORD=wordpress
WP_TABLE_PREFIX=wp_
WP_URL=http://localhost
WP_DOMAIN=localhost
[email protected]
ADMIN_USERNAME=admin
ADMIN_PASSWORD=password
ADMIN_PATH=/wp-admin

TEST_DB_NAME=wpgraphql_acf_tests
TEST_DB_HOST=127.0.0.1
TEST_DB_USER=wordpress
TEST_DB_PASSWORD=wordpress
TEST_WP_TABLE_PREFIX=wp_

SKIP_DB_CREATE=false
TEST_WP_ROOT_FOLDER=/tmp/wordpress
[email protected]

TESTS_DIR=tests
TESTS_OUTPUT=tests/_output
TESTS_DATA=tests/_data
TESTS_SUPPORT=tests/_support
TESTS_ENVS=tests/_envs

#WPGRAPHQL_VERSION=v1.3.3
SKIP_TESTS_CLEANUP=1
SUITES=wpunit
2 changes: 1 addition & 1 deletion .github/workflows/upload-schema-artifact.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Schema Linter
name: Schema Artifact

on:
workflow_dispatch:
Expand Down
20 changes: 8 additions & 12 deletions bin/install-test-env.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#!/usr/bin/env bash

if [[ ! -f ".env" ]]; then
echo "No .env file was detected. .env.dist has been copied to .env"
echo "Open the .env file and enter values to match your local environment"
cp .env.dist .env
fi

source .env

print_usage_instruction() {
echo "Ensure that .env file exist in project root directory exists."
echo "And run the following 'composer install-wp-tests' in the project root directory"
echo "And run the following 'composer build-test' in the project root directory"
exit 1
}

Expand Down Expand Up @@ -142,19 +148,10 @@ install_db() {
configure_wordpress() {
cd $WP_CORE_DIR
wp config create --dbname="$DB_NAME" --dbuser="$DB_USER" --dbpass="$DB_PASS" --dbhost="$DB_HOST" --skip-check --force=true
wp core install --url=wp.test --title="WPGraphQL ACF Tests" --admin_user=admin --admin_password=password [email protected]
wp core install --url=wp.test --title="WPGraphQL Tests" --admin_user=admin --admin_password=password [email protected]
wp rewrite structure '/%year%/%monthnum%/%postname%/'
}

install_acf_pro() {
if [ ! -d $WP_CORE_DIR/wp-content/plugins/advanced-custom-fields-pro ]; then
echo "Cloning ACF PRO"
git clone https://github.com/wp-premium/advanced-custom-fields-pro.git $WP_CORE_DIR/wp-content/plugins/advanced-custom-fields-pro
fi
echo "Cloning ACF PRO"
wp plugin activate advanced-custom-fields-pro
}

setup_plugin() {
# Add this repo as a plugin to the repo
if [ ! -d $WP_CORE_DIR/wp-content/plugins/wp-graphql-acf ]; then
Expand Down Expand Up @@ -190,5 +187,4 @@ setup_plugin() {
install_wp
install_db
configure_wordpress
install_acf_pro
setup_plugin

0 comments on commit e88ef9c

Please sign in to comment.