Skip to content

Commit

Permalink
fix: Parent connection classes namespaces updated. (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
kidunot89 committed Jan 24, 2023
1 parent e2a72bf commit c083fa5
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 40 deletions.
40 changes: 35 additions & 5 deletions bin/_lib.sh
Expand Up @@ -22,14 +22,13 @@ install_wordpress() {
# Install Wordpress + integrated plugins for testing/development.
composer install
composer require --dev -W \
composer/installers \
johnpbloch/wordpress:~${WP_VERSION} \
johnpbloch/wordpress:* \
wp-graphql/wp-graphql-jwt-authentication \
wpackagist-plugin/woocommerce \
wpackagist-plugin/woocommerce-gateway-stripe \
wpackagist-plugin/wp-graphql \
wpackagist-plugin/wp-graphql:* \
wpackagist-theme/twentytwentyone \
wp-cli/wp-cli-bundle:*
wp-cli/wp-cli-bundle
}

remove_wordpress() {
Expand All @@ -52,7 +51,7 @@ remove_wordpress() {
install_local_test_library() {
# Install testing library dependencies.
composer install
composer require --dev --with-all-dependencies \
composer require --dev \
lucatume/wp-browser \
codeception/module-asserts:^1.0 \
codeception/module-rest:^2.0 \
Expand All @@ -62,6 +61,23 @@ install_local_test_library() {

}

remove_local_composer_instance() {
if [ -f $PROJECT_ROOT_DIR/vendor/bin/composer ]; then
rm -f $PROJECT_ROOT_DIR/vendor/bin/composer
else
echo "No local composer instance found."
fi
}

remove_project_symlink() {
if [ -f $WP_CORE_DIR/wp-content/plugins/wp-graphql-woocommerce ]; then
rm -rf $WP_CORE_DIR/wp-content/plugins/wp-graphql-woocommerce
echo "Plugin symlink removed."
else
echo "Symlink no found."
fi
}

remove_local_test_library() {
# Remove testing library dependencies.
composer remove --dev wp-graphql/wp-graphql-testcase \
Expand All @@ -72,6 +88,20 @@ remove_local_test_library() {
stripe/stripe-php
}

cleanup_local_files() {
if [ -n "$(ls -A $WP_CORE_DIR)" ]; then
echo "Removing final test files..."
rm -rf $WP_CORE_DIR/*
echo "Files removed!!"
else
echo "No files to remove!"
fi

echo "Rebuilding lock file..."
rm -rf $PROJECT_ROOT_DIR/vendor $PROJECT_ROOT_DIR/composer.lock
composer install --no-dev
}

install_db() {
if [ ${SKIP_DB_CREATE} = "true" ]; then
echo "Skipping database creation..."
Expand Down
15 changes: 14 additions & 1 deletion bin/remove-wordpress.local.sh → bin/cleanup.local.sh
Expand Up @@ -15,10 +15,23 @@ BASEDIR=$(dirname "$0");
source ${BASEDIR}/_env.sh
source ${BASEDIR}/_lib.sh

# Remove any local Composer instances that could
# potentially get in the way of any file removals.
remove_local_composer_instance

# Uninstall WordPress from project and Composer.
remove_wordpress

composer install --no-dev
# Delete symlink to
remove_project_symlink

# Remove "extra" config.
composer config --unset extra.wordpress-install-dir
composer config --unset extra.installer-paths

# Remove testing dependencies from Composer.
remove_local_test_library

# Delete any missed files in the removal of the local installation.
# And rebuild composer.lock
cleanup_local_files
19 changes: 0 additions & 19 deletions bin/remove-testing-library.local.sh

This file was deleted.

5 changes: 1 addition & 4 deletions composer.json
Expand Up @@ -55,10 +55,7 @@
},
"scripts": {
"installTestEnv": "bash bin/install-test-env.local.sh",
"runPreCommitCleanup": [
"bash bin/remove-wordpress.local.sh",
"bash bin/remove-testing-library.local.sh"
],
"runPreCommitCleanup": "bash bin/cleanup.local.sh",
"runWPUnitTest": "vendor/bin/codecept run wpunit",
"dBuild": "env $(sed -e '/^#/d' .env.testing) docker-compose build",
"dRunApp": "env $(sed -e '/^#/d' .env.testing) docker-compose up testable_app app_db mailhog",
Expand Down
21 changes: 13 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion includes/connection/class-comments.php
Expand Up @@ -12,11 +12,12 @@

use GraphQL\Type\Definition\ResolveInfo;
use WPGraphQL\AppContext;
use WPGraphQL\Type\Connection\Comments as Comments_Core;

/**
* Class - Comments
*/
class Comments extends \WPGraphQL\Connection\Comments {
class Comments extends Comments_Core {

/**
* Registers connection.
Expand Down
2 changes: 1 addition & 1 deletion includes/connection/class-posts.php
Expand Up @@ -11,7 +11,7 @@

use GraphQL\Type\Definition\ResolveInfo;
use WPGraphQL\AppContext;
use WPGraphQL\Connection\PostObjects;
use WPGraphQL\Type\Connection\PostObjects;
use WPGraphQL\Data\Connection\PostObjectConnectionResolver;

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/connection/class-wc-terms.php
Expand Up @@ -13,7 +13,7 @@
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Error\UserError;
use WPGraphQL\AppContext;
use WPGraphQL\Connection\TermObjects;
use WPGraphQL\Type\Connection\TermObjects;
use WPGraphQL\Data\DataSource;
use WPGraphQL\Data\Connection\TermObjectConnectionResolver;
use WPGraphQL;
Expand Down

0 comments on commit c083fa5

Please sign in to comment.