Skip to content
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
9 changes: 9 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,12 @@ node_modules
*.sql
*.tar.gz
*.zip
.*
bin
docs
local
tests
netlify.toml
docker-compose.yml
codeception.yml
Dockerfile
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.env
.github_changelog_generator
.travis.yml
codeception.yml
codeception.yml
1 change: 0 additions & 1 deletion .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ jobs:
- name: Push Codecoverage to Coveralls.io
if: ${{ matrix.coverage == '--coverage --coverage-xml' && env.STRIPE_API_PUBLISHABLE_KEY != null }}
env:
COVERALLS_RUN_LOCALLY: 1
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: vendor/bin/php-coveralls -v

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/package-for-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
tag:
name: New release
name: Package new release
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -23,7 +23,6 @@ jobs:
- name: Create Artifact
run: |
mkdir plugin-build
rm -rf .* bin docs local tests netlify.toml docker-compose.yml Dockerfile
composer archive -vvv --format=zip --file="plugin-build/wp-graphql-woocommerce"
- name: Upload artifact
uses: actions/upload-artifact@v2
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ RUN composer global require --optimize-autoloader \
league/factory-muffin \
league/factory-muffin-faker \
stripe/stripe-php \
wp-graphql/wp-graphql-testcase \
"phpunit/phpunit:${PHPUNIT_VERSION}"

# Remove exec statement from base entrypoint script.
Expand Down
3 changes: 2 additions & 1 deletion bin/_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ fi

DB_HOST=${DB_HOST-localhost}
DB_PASS=${DB_PASSWORD-""}
WP_VERSION=${WP_VERSION-^5}
WP_VERSION=${WP_VERSION-5}
PHPUNIT_VERSION=${PHPUNIT_VERSION-8.1}
PROJECT_ROOT_DIR=$(pwd)
WP_CORE_DIR=${WP_CORE_DIR:-local/public}
PLUGINS_DIR=${PLUGINS_DIR:-"$WP_CORE_DIR/wp-content/plugins"}
Expand Down
20 changes: 11 additions & 9 deletions bin/_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ install_wordpress() {
wpackagist-plugin/woocommerce \
wpackagist-plugin/woocommerce-gateway-stripe \
wpackagist-plugin/wp-graphql \
wpackagist-theme/twentytwentyone
wpackagist-theme/twentytwentyone \
wp-cli/wp-cli-bundle
}

remove_wordpress() {
Expand All @@ -37,22 +38,23 @@ remove_wordpress() {
wpackagist-theme/twentytwentyone \
wpackagist-plugin/woocommerce \
johnpbloch/wordpress \
composer/installers
composer/installers \
wp-cli/wp-cli-bundle

composer update
}

install_local_test_library() {
# Install testing library dependencies.
composer install
composer require --dev lucatume/wp-browser \
composer require --dev phpunit/phpunit:<=${PHPUNIT_VERSION}
lucatume/wp-browser \
codeception/module-asserts \
codeception/module-rest \
codeception/util-universalframework \
wp-graphql/wp-graphql-testcase \
simpod/php-coveralls-mirror \
stripe/stripe-php \
wp-cli/wp-cli-bundle
php-coveralls/php-coveralls \
stripe/stripe-php
}

remove_local_test_library() {
Expand All @@ -62,9 +64,9 @@ remove_local_test_library() {
codeception/module-rest \
codeception/util-universalframework \
lucatume/wp-browser \
simpod/php-coveralls-mirror \
stripe/stripe-php \
wp-cli/wp-cli-bundle
phpunit/phpunit \
php-coveralls/php-coveralls \
stripe/stripe-php

composer update
}
Expand Down
8 changes: 7 additions & 1 deletion includes/connection/class-orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,13 @@ public static function map_input_fields_to_wp_query( $query_args, $where_args, $
);

$prefixer = function( $status ) {
return "wc-{$status}";
$statuses = array_keys( \wc_get_order_statuses() );

if ( in_array( "wc-{$status}", $statuses, true ) ) {
return "wc-{$status}";
}

return $status;
};

foreach ( $key_mapping as $key => $field ) {
Expand Down
18 changes: 9 additions & 9 deletions includes/type/enum/class-order-status.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class Order_Status {
* Registers type
*/
public static function register() {
$values = array(
'PENDING' => array( 'value' => 'pending' ),
'PROCESSING' => array( 'value' => 'processing' ),
'ON_HOLD' => array( 'value' => 'on-hold' ),
'COMPLETED' => array( 'value' => 'completed' ),
'CANCELLED' => array( 'value' => 'cancelled' ),
'REFUNDED' => array( 'value' => 'refunded' ),
'FAILED' => array( 'value' => 'failed' ),
);
$statuses = \wc_get_order_statuses();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces must be used to indent lines; tabs are not allowed


$values = array();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces must be used to indent lines; tabs are not allowed

foreach ( $statuses as $status => $description ) {
$split_status_slug = explode( 'wc-', $status );
$value = array_pop( $split_status_slug );
$key = strtoupper( str_replace( '-', '_', $value ) );
$values[ $key ] = compact( 'value', 'description' );
}

register_graphql_enum_type(
'OrderStatusEnum',
Expand Down