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

feat: HPOS support added. #748

Merged
merged 17 commits into from
Jun 21, 2023
Merged
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
14 changes: 8 additions & 6 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ jobs:
strategy:
matrix:
php: ['8.0', '7.4', '7.3']
wordpress: ['6.0', '5.9', '5.6']
wordpress: ['6.2', '6.1', '6.0']
composer_version: ['v2']
include:
- php: '7.4'
wordpress: '5.9'
wordpress: '6.2'
coverage: '--coverage --coverage-xml'
xdebug: 1
- php: '7.3'
wordpress: '5.6'
wordpress: '6.1'
debug: '--debug'
- wordpress: '6.2'
hpos: 0

fail-fast: false
name: WordPress ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
name: Running Automated Tests w/ WPBrowser in WordPress v${{ matrix.wordpress }} on PHP${{ matrix.php }} ${{ matrix.hpos == 1 && 'with HPOS activated ' || '' }}${{ matrix.coverage == '--coverage --coverage-xml' && 'with Codecoverage ' || '' }}${{ matrix.debug == '--debug' && 'in Debug Mode ' || '' }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -54,12 +56,12 @@ jobs:
composer install
WP_VERSION=${{ matrix.wordpress }} SKIP_DB_CREATE=true SKIP_WP_SETUP=true composer installTestEnv

- name: Run Tests w/ Docker.
- name: Run Tests.
env:
USING_XDEBUG: ${{ matrix.xdebug }}
WP_VERSION: ${{ matrix.wordpress }}
PHP_VERSION: ${{ matrix.php }}
run: FILTER="${{ matrix.coverage }} ${{ matrix.debug }}" composer dRunTestStandalone
run: HPOS="${{ matrix.hpos }}" FILTER="${{ matrix.coverage }} ${{ matrix.debug }}" composer dRunTestStandalone

- name: Push Codecoverage to Coveralls.io
if: ${{ matrix.coverage == '--coverage --coverage-xml' && env.STRIPE_API_PUBLISHABLE_KEY != null }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
Coding-Standards:
runs-on: ubuntu-latest
name: "Linting WooGraphQL code with PHPCS"
name: "Linting WooGraphQL code w/ PHPCS"
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion bin/_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ install_wordpress() {
wpackagist-plugin/woocommerce-gateway-stripe \
wpackagist-plugin/wp-graphql \
wpackagist-theme/twentytwentyone \
wp-cli/wp-cli-bundle
wp-cli/wp-cli-bundle:*
}

remove_wordpress() {
Expand Down
2 changes: 0 additions & 2 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ coverage:
exclude:
- 'local/*'
- 'vendor/*'
- 'includes/utils/class-ql-session-handler.php'
- 'class-woographql-inflect.php'
- 'wp-graphql-woocommerce.php'
show_only_summary: false
extensions:
Expand Down
34 changes: 17 additions & 17 deletions composer.lock

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

1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ services:
WORDPRESS_DOMAIN: localhost
WP_SITEURL: http://localhost
WP_HOME: http://localhost
HPOS: ${HPOS:-}
command: ./setup-database.sh testing codecept run ${FILTER:-}
networks:
testing:
Expand Down
3 changes: 2 additions & 1 deletion includes/admin/class-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static function get_other_nonce_values( $excluded ) {
*/
public static function get_fields() {
$custom_endpoint = apply_filters( 'woographql_authorizing_url_endpoint', null );
$enabled_authorizing_url_fields = array_keys( woographql_setting( 'enable_authorizing_url_fields', [] ) );
$enabled_authorizing_url_fields = woographql_setting( 'enable_authorizing_url_fields', [] );
$enabled_authorizing_url_fields = ! empty( $enabled_authorizing_url_fields ) ? array_keys( $enabled_authorizing_url_fields ) : [];
$all_urls_checked = apply_filters(
'woographql_enabled_authorizing_url_fields',
[
Expand Down
14 changes: 0 additions & 14 deletions includes/class-core-schema-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ public static function add_filters() {
3
);

add_filter(
'graphql_post_object_connection_query_args',
[ '\WPGraphQL\WooCommerce\Connection\Orders', 'post_object_connection_query_args' ],
10,
5
);

add_filter(
'graphql_map_input_fields_to_wp_query',
[ '\WPGraphQL\WooCommerce\Connection\Coupons', 'map_input_fields_to_wp_query' ],
Expand All @@ -106,13 +99,6 @@ public static function add_filters() {
7
);

add_filter(
'graphql_map_input_fields_to_wp_query',
[ '\WPGraphQL\WooCommerce\Connection\Orders', 'map_input_fields_to_wp_query' ],
10,
7
);

add_filter(
'graphql_map_input_fields_to_wp_user_query',
[ '\WPGraphQL\WooCommerce\Connection\Customers', 'map_input_fields_to_wp_query' ],
Expand Down
24 changes: 19 additions & 5 deletions includes/class-wp-graphql-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ private function includes() {
require $include_directory_path . 'model/class-product.php';
require $include_directory_path . 'model/class-product-variation.php';
require $include_directory_path . 'model/class-order.php';
require $include_directory_path . 'model/class-refund.php';
require $include_directory_path . 'model/class-order-item.php';
require $include_directory_path . 'model/class-shipping-method.php';
require $include_directory_path . 'model/class-tax-rate.php';
Expand All @@ -176,8 +175,10 @@ private function includes() {

// Include connection resolver trait/class files.
require $include_directory_path . 'data/connection/trait-wc-db-loader-common.php';
require $include_directory_path . 'data/connection/trait-wc-cpt-loader-common.php';
require $include_directory_path . 'data/connection/class-cart-item-connection-resolver.php';
require $include_directory_path . 'data/connection/class-downloadable-item-connection-resolver.php';
require $include_directory_path . 'data/connection/class-order-connection-resolver.php';
require $include_directory_path . 'data/connection/class-order-item-connection-resolver.php';
require $include_directory_path . 'data/connection/class-payment-gateway-connection-resolver.php';
require $include_directory_path . 'data/connection/class-product-attribute-connection-resolver.php';
Expand All @@ -186,11 +187,8 @@ private function includes() {
require $include_directory_path . 'data/connection/class-variation-attribute-connection-resolver.php';

// Include deprecated resolver trait/class files.
require $include_directory_path . 'data/connection/trait-wc-cpt-loader-common.php';
require $include_directory_path . 'data/connection/class-coupon-connection-resolver.php';
require $include_directory_path . 'data/connection/class-product-connection-resolver.php';
require $include_directory_path . 'data/connection/class-refund-connection-resolver.php';
require $include_directory_path . 'data/connection/class-order-connection-resolver.php';
require $include_directory_path . 'data/connection/class-customer-connection-resolver.php';

// Include mutation processor class files.
Expand All @@ -203,6 +201,10 @@ private function includes() {
// Include factory class file.
require $include_directory_path . 'data/class-factory.php';

// Include DB hooks class files.
require $include_directory_path . 'data/cursor/class-cot-cursor.php';
require $include_directory_path . 'data/class-db-hooks.php';

// Include enum type class files.
require $include_directory_path . 'type/enum/class-backorders.php';
require $include_directory_path . 'type/enum/class-cart-error-type.php';
Expand Down Expand Up @@ -378,14 +380,23 @@ function () {
}//end if
}

/**
* Returns true if any authorizing urls are enabled.
*
* @return array
*/
public static function get_enabled_auth_urls() {
return woographql_setting( 'enable_authorizing_url_fields', [] );
}

/**
* Returns true if any authorizing urls are enabled.
*
* @return bool
*/
public static function auth_router_is_enabled() {
return defined( 'WPGRAPHQL_WOOCOMMERCE_ENABLE_AUTH_URLS' )
|| ! empty( array_keys( woographql_setting( 'enable_authorizing_url_fields', [] ) ) );
|| ! empty( self::get_enabled_auth_urls() );
}

/**
Expand All @@ -407,6 +418,9 @@ private function setup() {
// Initialize WooGraphQL Settings.
new Admin();

// Initialize WooGraphQL DB hooks.
new Data\DB_Hooks();

// Setup minor integrations.
Functions\setup_minor_integrations();

Expand Down
Loading