From 79f2936ae95ceaa68c3b4cdad8325d5ed217758f Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Fri, 3 Dec 2021 12:25:20 +0100 Subject: [PATCH] Temporary fix for a unit test. The "Advanced" section in the product settings page exists only if the product attributes lookup table exists. The table will eventually exist for everybody, so a temporary check has been added. --- .../class-wc-settings-products-test.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/woocommerce/tests/php/includes/settings/class-wc-settings-products-test.php b/plugins/woocommerce/tests/php/includes/settings/class-wc-settings-products-test.php index 5f7941e6af6..815d7207f08 100644 --- a/plugins/woocommerce/tests/php/includes/settings/class-wc-settings-products-test.php +++ b/plugins/woocommerce/tests/php/includes/settings/class-wc-settings-products-test.php @@ -7,6 +7,8 @@ // phpcs:ignore Squiz.Commenting.FileComment.Missing +use Automattic\WooCommerce\Internal\ProductAttributesLookup\LookupDataStore; + require_once __DIR__ . '/class-wc-settings-unit-test-case.php'; /** @@ -28,6 +30,11 @@ class WC_Settings_Products_Test extends WC_Settings_Unit_Test_Case { 'downloadable', ); + // TODO: Once the lookup table is created in a migration, remove the check and just include 'advanced' in $expected. + if ( wc_get_container()->get( LookupDataStore::class )->check_lookup_table_exists() ) { + array_push( $expected, 'advanced' ); + } + $this->assertEquals( $expected, $section_names ); } @@ -134,12 +141,12 @@ class WC_Settings_Products_Test extends WC_Settings_Unit_Test_Case { $settings_ids_and_types = $this->get_ids_and_types( $settings ); $expected = array( - 'digital_download_options' => array( 'title', 'sectionend' ), - 'woocommerce_file_download_method' => 'select', - 'woocommerce_downloads_redirect_fallback_allowed' => 'checkbox', - 'woocommerce_downloads_require_login' => 'checkbox', + 'digital_download_options' => array( 'title', 'sectionend' ), + 'woocommerce_file_download_method' => 'select', + 'woocommerce_downloads_redirect_fallback_allowed' => 'checkbox', + 'woocommerce_downloads_require_login' => 'checkbox', 'woocommerce_downloads_grant_access_after_payment' => 'checkbox', - 'woocommerce_downloads_add_hash_to_filename' => 'checkbox', + 'woocommerce_downloads_add_hash_to_filename' => 'checkbox', ); $this->assertEquals( $expected, $settings_ids_and_types );