woocommerce/tests/legacy/unit-tests
Nestor Soriano 9c6c0d73d8 Record attribute terms for product variations in wp_term_relationships.
Product attributes are currently recorded as terms in
wp_term_relationships (product attributes are actually taxonomies).
In the case of variable products this is true for the main product,
but not for the variations. The attributes used to define variations
are stored as post meta, but nothing is recorded in the term
relationships table.

This is a problem when using the layered nav filtering plugin,
since the attribute counters displayed are calculated based solely
on the contents of the term relationships table. Adding meta queries
would be really messy (especially when the widget is configured
with AND operator) and would probably also hurt performance.

This commit adds a change to store the attributes for variations
as term relationships, additionally to storing them as post meta.
Terms are stored on variation creation, and updated/deleted together
with the variation as appropriate. "Any" variations (stored in meta
as empty values) are not stored as terms.

Additionally, a database upgrade is included in order to backfill
terms for already existing products.
2020-07-28 08:55:55 +02:00
..
account Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
admin Removed deprecated method call. 2020-06-16 13:18:05 +02:00
attributes Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
cart Add more assertions in tests for order totals. 2020-07-24 19:12:25 +05:30
checkout Revert "Revert "Introduce a `reserved stock` class and database table to prevent race conditions during checkout"" 2020-06-05 15:18:01 +05:30
core add template cache unit test 2020-06-22 16:05:29 -03:00
countries Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
coupon Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
crud Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
customer Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
discounts Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
email Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
exporter Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
formatting Fixed unit tests for #26462 2020-07-01 18:13:29 -03:00
gateways Add login_as_role and login_as_administrator to WC_Unit_Test_Case. 2020-07-14 11:42:21 +02:00
geolocation Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
importer Improvements on the code hacker. 2020-05-20 09:56:26 +02:00
integrations Improvements on the code hacker. 2020-05-20 09:56:26 +02:00
libraries Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
log Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
order Fixed unit tests for #26462 2020-07-01 18:13:29 -03:00
order-items Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
packages Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
page-functions Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
payment-gateways Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
payment-tokens Add login_as_role and login_as_administrator to WC_Unit_Test_Case. 2020-07-14 11:42:21 +02:00
privacy Merge branch 'privacy-exporter-group-description' of git://github.com/garretthyder/woocommerce into garretthyder-privacy-exporter-group-description 2020-05-12 09:40:17 -07:00
product Record attribute terms for product variations in wp_term_relationships. 2020-07-28 08:55:55 +02:00
queue Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
session Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
settings Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
setup Add login_as_role and login_as_administrator to WC_Unit_Test_Case. 2020-07-14 11:42:21 +02:00
shipping Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
shortcodes Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
tax Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
templates Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
totals Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
util Fix visibility of variable products with layered nav filtering. 2020-07-28 08:55:52 +02:00
webhooks Queue all webhooks on shutdown. 2020-07-27 12:11:40 -04:00
widgets Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00