Skip to content

Commit 9d0bd64

Browse files
committed
no message
1 parent 4fbcd04 commit 9d0bd64

File tree

1 file changed

+4
-43
lines changed

1 file changed

+4
-43
lines changed

bin/install-wp-tests.sh

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ DB_HOST=${4-localhost}
1212
WP_VERSION=${5-latest}
1313
SKIP_DB_CREATE=${6-false}
1414

15-
PLUGIN_DIR=$(pwd)
16-
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
17-
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
18-
DB_SERVE_NAME=${DB_SERVE_NAME-wpgraphql_jwt_auth_serve}
15+
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wp-graphql-jwt-authentication/wordpress-tests-lib}
16+
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wp-graphql-jwt-authentication/wordpress/}
1917

2018
download() {
2119
if [ `which curl` ]; then
@@ -120,53 +118,16 @@ install_db() {
120118
fi
121119
fi
122120

123-
124-
RESULT=`mysql -u $DB_USER --password="$DB_PASS" --skip-column-names -e "SHOW DATABASES LIKE '$DB_NAME'"`
125-
if [ "$RESULT" != $DB_NAME ]; then
126-
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
127-
fi
128-
129-
RESULT_2=`mysql -u $DB_USER --password="$DB_PASS" --skip-column-names -e "SHOW DATABASES LIKE '$DB_SERVE_NAME'"`
130-
if [ "$RESULT_2" != $DB_SERVE_NAME ]; then
131-
mysqladmin create $DB_SERVE_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
132-
fi
133-
134-
}
135-
136-
configure_wordpress() {
137-
138-
cd $WP_CORE_DIR
139-
wp config create --dbname="$DB_SERVE_NAME" --dbuser=root --dbpass="$DB_PASS" --dbhost="$DB_HOST" --skip-check --force=true
140-
wp core install --url=wpgraphql.test --title="WPGraphQL Tests" --admin_user=admin --admin_password=password [email protected]
141-
wp rewrite structure '/%year%/%monthnum%/%postname%/'
121+
# create database
122+
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
142123
}
143124

144125
install_wpgraphql() {
145126
echo "Cloning WPGraphQL"
146127
git clone https://github.com/wp-graphql/wp-graphql.git $WP_CORE_DIR/wp-content/plugins/wp-graphql
147128
}
148129

149-
activate_plugins() {
150-
151-
# Add this repo as a plugin to the repo
152-
ln -s $PLUGIN_DIR $WP_CORE_DIR/wp-content/plugins/wp-graphql-jwt-authentication
153-
154-
cd $WP_CORE_DIR
155-
156-
# activate the plugin
157-
wp plugin activate wp-graphql
158-
wp plugin activate wp-graphql-jwt-authentication
159-
160-
# Flush the permalinks
161-
wp rewrite flush
162-
163-
# Export the db for codeception to use
164-
wp db export $PLUGIN_DIR/tests/_data/dump.sql
165-
}
166-
167130
install_wp
168131
install_test_suite
169132
install_db
170-
configure_wordpress
171133
install_wpgraphql
172-
activate_plugins

0 commit comments

Comments
 (0)