Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Move notices to corresponding context (#8228)
Browse files Browse the repository at this point in the history
* Updated package-lock.json

* fixed method sig

* PHP versions matrix

* removed extra space

* renamed step

* Update E2E and coding standards to use PHP 8.0

* Un-linted unit-tests.yml. Github flows use 4 spaces indent, while our .editorconfig file enforces 2 spaces.

* Refactor unit-tests.yml

* Linted unit-tests.yml to proper 2 space indents

* Removed composer caching

* Test without hacky permissions step

* Concurrency disable.
Jobs renaming.

* Add step to install wp-env for PHP unit tests.

* Another try at fixing perms for wp-env

* Another try at fixing perms for wp-env

* Restore missing steps

* Move notices to corresponding context

* Change `errorMessageContext` to `context`

* Fix MD lint errors

Co-authored-by: Paulo Arromba <[email protected]>
  • Loading branch information
nielslange and wavvves authored Jan 24, 2023
1 parent 774b8fa commit 2751425
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/php-js-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: '8.0'
coverage: none
tools: composer

Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: '8.0'
coverage: none
tools: composer

Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
Expand Down Expand Up @@ -108,7 +107,6 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install PHP deps
run: composer install

Expand All @@ -117,14 +115,12 @@ jobs:
mkdir -p ./wp-content/uploads/wc-logs
echo 'deny from all' > ./wp-content/uploads/wc-logs/.htaccess
chmod -R 777 ./
- name: Run PHPUnit tests
run: |
JSON='{"phpVersion": "${{ matrix.php }}"}'
echo $JSON > .wp-env.override.json
npm run wp-env start --update
npm run test:php
- name: Run PHPUnit tests (WooCommerce Development Version)
run: |
JSON='{"plugins": [".","https://downloads.wordpress.org/plugin/woocommerce.zip"], "phpVersion": "${{ matrix.php }}"}'
Expand All @@ -133,7 +129,6 @@ jobs:
rm -rf /home/runner/wp-env/*
npm run wp-env start --update
npm run test:php
JSUnitTests:
name: JS Unit Tests
needs: Setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ const CheckoutProcessor = () => {
'There was a problem with your payment option.',
'woo-gutenberg-products-block'
),
context: 'wc/checkout/payments',
};
}
if ( shippingErrorStatus.hasError ) {
Expand All @@ -175,6 +176,7 @@ const CheckoutProcessor = () => {
'There was a problem with your shipping option.',
'woo-gutenberg-products-block'
),
context: 'wc/checkout/shipping-methods',
};
}

Expand Down
10 changes: 6 additions & 4 deletions assets/js/data/checkout/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ export const __internalEmitValidateEvent: emitValidateEventType = ( {
if ( response !== true ) {
if ( Array.isArray( response ) ) {
response.forEach(
( { errorMessage, validationErrors } ) => {
createErrorNotice( errorMessage, {
context: 'wc/checkout',
} );
( {
errorMessage,
validationErrors,
context = 'wc/checkout',
} ) => {
createErrorNotice( errorMessage, { context } );
setValidationErrors( validationErrors );
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ The checkout block has an API interface for payment methods to integrate that co

## Table of Contents <!-- omit in toc -->

- [Client Side integration](#client-side-integration)
- [Express payment methods - `registerExpressPaymentMethod( options )`](#express-payment-methods---registerexpresspaymentmethod-options-)
- [Aliased import](#aliased-import)
- [`wc global`](#wc-global)
- [The registration options](#the-registration-options)
- [`name` (required)](#name-required)
- [`content` (required)](#content-required)
- [`edit` (required)](#edit-required)
- [`canMakePayment` (required)](#canmakepayment-required)
- [`paymentMethodId`](#paymentmethodid)
- [`supports:features`](#supportsfeatures)
- [Payment Methods - `registerPaymentMethod( options )`](#payment-methods---registerpaymentmethod-options-)
- [Aliased import](#aliased-import-1)
- [`wc global`](#wc-global-1)
- [The registration options](#the-registration-options-1)
- [Props Fed to Payment Method Nodes](#props-fed-to-payment-method-nodes)
- [Server Side Integration](#server-side-integration)
- [Processing Payment](#processing-payment)
- [Registering Assets](#registering-assets)
- [Hooking into the Checkout processing by the Store API](#hooking-into-the-checkout-processing-by-the-store-api)
- [Putting it all together](#putting-it-all-together)
- [Client Side integration](#client-side-integration)
- [Express payment methods - `registerExpressPaymentMethod( options )`](#express-payment-methods---registerexpresspaymentmethod-options-)
- [Aliased import](#aliased-import)
- [`wc global`](#wc-global)
- [The registration options](#the-registration-options)
- [`name` (required)](#name-required)
- [`content` (required)](#content-required)
- [`edit` (required)](#edit-required)
- [`canMakePayment` (required)](#canmakepayment-required)
- [`paymentMethodId`](#paymentmethodid)
- [`supports:features`](#supportsfeatures)
- [Payment Methods - `registerPaymentMethod( options )`](#payment-methods---registerpaymentmethod-options-)
- [Aliased import](#aliased-import-1)
- [`wc global`](#wc-global-1)
- [The registration options](#the-registration-options-1)
- [Props Fed to Payment Method Nodes](#props-fed-to-payment-method-nodes)
- [Server Side Integration](#server-side-integration)
- [Processing Payment](#processing-payment)
- [Registering Assets](#registering-assets)
- [Hooking into the Checkout processing by the Store API](#hooking-into-the-checkout-processing-by-the-store-api)
- [Putting it all together](#putting-it-all-together)

## Client Side integration

Expand Down

0 comments on commit 2751425

Please sign in to comment.