Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test with the latest wp-graphql #14

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

- name: Use php 7.2
uses: shivammathur/setup-php@v2
with:
php-version: "7.2"

- uses: actions/cache@v1
id: cache-composer
Expand Down
2 changes: 1 addition & 1 deletion codeception.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ modules:
dbHost: "%WPTT_DB_HOST%"
dbUser: "%WPTT_DB_USER%"
dbPassword: "%WPTT_DB_PASSWORD%"
tablePrefix: "_wp"
tablePrefix: "wp_"
domain: "%WPTT_SITE_HOST%"
adminEmail: "%WPTT_SITE_ADMIN_EMAIL%"
title: "Test"
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require-dev": {
"valu/wp-testing-tools": "^0.4.0",
"valu/wp-testing-tools": "^0.6.0",
"lucatume/wp-browser": "^2.2",
"phpunit/phpunit": "^8.0",
"codeception/module-asserts": "^1.0",
Expand Down
2 changes: 1 addition & 1 deletion composer.wp-install.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"require": {
"composer/installers": "^1.0",
"wp-graphql/wp-graphql": "^0.8.4"
"wp-graphql/wp-graphql": "1.6.10"
},
"extra": {
"installer-paths": {
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN apt-get update \
ca-certificates \
mariadb-client

RUN curl -L https://github.com/composer/composer/releases/download/1.9.1/composer.phar -o /usr/local/bin/composer && chmod +x /usr/local/bin/composer
RUN curl -L https://github.com/composer/composer/releases/download/2.1.8/composer.phar -o /usr/local/bin/composer && chmod +x /usr/local/bin/composer

ARG XDEBUG=/etc/php/7.2/cli/conf.d/20-xdebug.ini
RUN echo "[XDebug]" >> ${XDEBUG} \
Expand Down
8 changes: 8 additions & 0 deletions docker/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ composer install

composer wp-install

cat > $HOME/.my.cnf <<EOF
[client]
user=${WPTT_DB_USER}
password=${WPTT_DB_PASSWORD}
host=${WPTT_DB_HOST}
database=${WPTT_DB_NAME}
EOF


if [ "$(wp-install --status)" = "full" ]; then
>&2 echo "WP is running at http://localhost:8080/ and run tests against it using 'docker/run shell'"
Expand Down
14 changes: 13 additions & 1 deletion docker/run
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ help() {
Start the container without installing anything. Usefull for
debugging or developing install steps

$cmd clean
Remove the installation directory and containers

"
}

Expand All @@ -37,7 +40,7 @@ fi
echo "# Generated file. Do not edit. Edit .env.docker instead" > .env
echo "" >> .env
cat .env.docker >> .env
eval $(grep -v '^#' .env)
export $(grep -v '^#' .env | xargs)


shell() {
Expand Down Expand Up @@ -78,6 +81,11 @@ update() {
exit 5
}

clean() {
rm -rf "$WPTT_INSTALL_DIR"
compose rm
}

case "${1:-}" in
-h|--help)
help
Expand All @@ -104,6 +112,10 @@ case "${1:-}" in
shift
update
;;
clean)
shift
clean
;;
*)
>&2 echo "Bad action ${1:-}"
exit 1
Expand Down
5 changes: 5 additions & 0 deletions src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ function op_filter_graphql_connection_query_args(
$query_args,
AbstractConnectionResolver $resolver
) {

if (!is_array($query_args)) {
return $query_args;
}

$info = $resolver->getInfo();
$selection_set = $info->getFieldSelection(2);

Expand Down
2 changes: 2 additions & 0 deletions tests/_data/config.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

define('GRAPHQL_DEBUG', true);

require_once __DIR__ . '/../../.wp-install/vendor/autoload.php';