Skip to content

Commit 420bc42

Browse files
committed
- Adding refresh token stuff and initial Codeception setup.
1 parent d7dfe37 commit 420bc42

File tree

408 files changed

+116256
-717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

408 files changed

+116256
-717
lines changed

bin/install-wp-tests.sh

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

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/}
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}
1719

1820
download() {
1921
if [ `which curl` ]; then
@@ -118,16 +120,53 @@ install_db() {
118120
fi
119121
fi
120122

121-
# create database
122-
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
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%/'
123142
}
124143

125144
install_wpgraphql() {
126145
echo "Cloning WPGraphQL"
127146
git clone https://github.com/wp-graphql/wp-graphql.git $WP_CORE_DIR/wp-content/plugins/wp-graphql
128147
}
129148

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+
130167
install_wp
131168
install_test_suite
132169
install_db
170+
configure_wordpress
133171
install_wpgraphql
172+
activate_plugins

client/UserAdmin/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
6+
# testing
7+
/coverage
8+
9+
# production
10+
/build
11+
12+
# misc
13+
.DS_Store
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*

client/UserAdmin/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# User Admin
2+
3+
This is a small React App for managing per-user details re: WPGraphQL JWT Auth
4+
5+
The app is rendered in the User Profile screen.
6+
7+
This app was created with Create React App and can be run and built using Create React App scripts.
8+
pwd
9+

0 commit comments

Comments
 (0)