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

Commit

Permalink
Testing instructions for #11862 and #11860
Browse files Browse the repository at this point in the history
  • Loading branch information
wavvves committed Nov 21, 2023
1 parent a2ef678 commit 1301b11
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
47 changes: 47 additions & 0 deletions docs/internal-developers/testing/releases/1160.md
Expand Up @@ -358,3 +358,50 @@ Twenty-Twenty Two | ![imatge](https://github.com/woocommerce/woocommerce-blocks/
4. Set the price filters in a way that there are no products displayed, for example, slide min price fully to the right.
5. Open the console.
6. Ensure no error is visible.

### Fix arguments passed to woocommerce_before_thankyou to mirror core hook [#11862](https://github.com/woocommerce/woocommerce-blocks/pull/11862)

From the issue (requires code):

1. Implement a function that expects an integer for the order ID, attached to the woocommerce_before_thankyou hook.

```php
function test_function_11851( int $order_id ): void {
printf( 'Hello, this is order %d', $order_id );
}
add_action( 'woocommerce_before_thankyou', 'test_function_11851' );
```

2. Place an order on the WooCommerce store.
3. Thanks page should show without errors. Should see `Hello, this is order X`

### Validate coupon usage against customer id AND emails [#11860](https://github.com/woocommerce/woocommerce-blocks/pull/11860)

#### From logged in to logged out

1. Create a new coupon and limit its usage to 1 per customer.
2. Logged in, with an email you remember, place an order using that coupon, it should pass.
3. Logged out, using the same email, try placing an order with that coupon, you should get a top level error "coupon_name" was removed from the cart. Coupon usage limit has been reached.".

#### User email vs billing email

1. Create a new coupon and limit its usage to 1 per customer.
2. Logged in, with an user email you remember, place an order using that coupon, and a different billing email. It should pass.
3. Logged out, using the same user email (not the billing email), try placing an order with that coupon, you should get a top level error "coupon_name" was removed from the cart. Coupon usage limit has been reached.".

#### From logged out to logged in

1. Create a new coupon and limit its usage to 1 per customer.
4. Logged out, use the coupon with an email you remember, that email should belong to an existing user.
5. You should be able to place the order fine.
6. Logged in with the user that own that email.
7. Go to checkout, add the coupon, using the same email, try to place the order.
8. You should get a top level error.
9. Change your billing email to something else, add the coupon again.
10. Try to place the order, you should get an error.

#### General regression testing

1. Create a new coupon and limit its usage to 1 per customer.
2. Logged in, with an email you remember, place an order using that coupon, it should pass.
3. Logged in again, back to checkout, change your email, and try adding the coupon, you should get an inline error that you can't use the coupon.
2 changes: 2 additions & 0 deletions readme.txt
Expand Up @@ -108,6 +108,8 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](https:/
- Fix the Layout for Shipping and Billing Address Forms in the Checkout Block [#11486](https://github.com/woocommerce/woocommerce-blocks/pull/11486)
- Minor fixes for PHP 8. [#11473](https://github.com/woocommerce/woocommerce-blocks/pull/11473)
- Product Button: always enqueue the store. [#11858](https://github.com/woocommerce/woocommerce-blocks/pull/11858)
- Fixed params passed to woocommerce_before_thankyou for block checkout. This should be an order ID, not an order object. [#11862](https://github.com/woocommerce/woocommerce-blocks/pull/11862)
- Enhanced validation for limited use coupons and guest users. [#11860](https://github.com/woocommerce/woocommerce-blocks/pull/11860)

#### Documentation

Expand Down

0 comments on commit 1301b11

Please sign in to comment.