Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
81 stars 29 forks source link

Updating tests to optionally run with HPOS enabled. #449

Closed prettyboymp closed 1 year ago

prettyboymp commented 1 year ago

Purpose

With the offering of HPOS/Customer Order Storage for WooCommerce Core, we need to be able to easily run tests with HPOS enabled to ensure compatibility.

This enables running the testsuite with HPOS enabled by declaring a HPOS environmental variable when running the tests. E.g. $> HPOS=1 ./vendor/bin/phpunit. The goal is to allow these to be run separately with the automated test suites.

Description

This includes the folllwing:

  1. Modified the boostrap to turn on HPOS (without Post syncing) options after including WooCommerce during test initialization.
  2. Updates some of the tests that failed with HPOS enabled simply due to the test itself relying solely on post_meta.

Other tests and fixes will be separate PR's.

How to test this PR

  1. Follow the testing instructions given in the subscriptions-core Unit Tests.
  2. Set the HPOS environmental variable when running the test: $> HPOS=1 ./vendor/bin/phpunit

Product impact

prettyboymp commented 1 year ago

I see a bunch of errors when running $ HPOS=1 ./vendor/bin/phpunit but as I understand it these will be fixed in separate PRs correct?

Correct. I thought it was better to address any fixes that required changes to source as separate PR's so i limited the scope of this to just altering the tests for now.

mattallan commented 1 year ago

I thought it was better to address any fixes that required changes to source as separate PR's so i limited the scope of this to just altering the tests for now.

Sounds good to me. Acknowledging there are some phpcs issues causing one of our checks to fail but this was not introduced by this PR. Merging