From b62ffa6f9488f43cc28473f33a53664a4e35a19c Mon Sep 17 00:00:00 2001 From: Eli Lisseck Date: Mon, 20 Oct 2025 18:02:21 -0700 Subject: [PATCH 1/6] Backdrop patches for the old customer_ui and tax_ui tests. All tests pass in the GUI, but several fails using CLI. This PR will test what passes in github actions. --- modules/customer/commerce_customer.info | 2 ++ .../customer/tests/commerce_customer_ui.test | 6 +++-- modules/tax/commerce_tax.info | 1 + modules/tax/tests/commerce_tax_ui.test | 22 ++++++++++++++----- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/modules/customer/commerce_customer.info b/modules/customer/commerce_customer.info index 04283b3d..6f2a338e 100644 --- a/modules/customer/commerce_customer.info +++ b/modules/customer/commerce_customer.info @@ -4,6 +4,8 @@ package = Commerce dependencies[] = system (>=1.31.1) dependencies[] = addressfield dependencies[] = commerce +dependencies[] = commerce_checkout dependencies[] = entity + backdrop = 1.x type = module diff --git a/modules/customer/tests/commerce_customer_ui.test b/modules/customer/tests/commerce_customer_ui.test index cbef2f10..f770cd9a 100644 --- a/modules/customer/tests/commerce_customer_ui.test +++ b/modules/customer/tests/commerce_customer_ui.test @@ -405,7 +405,7 @@ class CommerceCustomerUITest extends CommerceBaseTestCase { // Fill in the billing address information $billing_pane = $this->xpath("//select[starts-with(@name, 'customer_profile_billing[commerce_customer_address]')]"); - //$this->backdropPostAJAX(NULL, array((string) $billing_pane[0]['name'] => 'US'), (string) $billing_pane[0]['name']); + $this->backdropPostAJAX(NULL, array((string) $billing_pane[0]['name'] => 'US'), (string) $billing_pane[0]['name']); // Check if the country has been selected correctly, this uses XPath as the // ajax call replaces the element and the id may change @@ -430,8 +430,10 @@ class CommerceCustomerUITest extends CommerceBaseTestCase { // Check the customer profile at database level. $orders = commerce_order_load_multiple(array($order->order_id), array(), TRUE); + $order = reset($orders); - $profile = commerce_customer_profile_load($order->data['profiles']['customer_profile_billing']); + + $profile = commerce_customer_profile_load($order->commerce_customer_billing['und'][0]['profile_id']); $address = $profile->commerce_customer_address['und'][0]; $test = []; diff --git a/modules/tax/commerce_tax.info b/modules/tax/commerce_tax.info index c22e3b14..d189a627 100644 --- a/modules/tax/commerce_tax.info +++ b/modules/tax/commerce_tax.info @@ -4,6 +4,7 @@ package = Commerce dependencies[] = commerce dependencies[] = commerce_line_item dependencies[] = commerce_price +dependencies[] = commerce_product_ui dependencies[] = commerce_product_pricing dependencies[] = entity dependencies[] = rules diff --git a/modules/tax/tests/commerce_tax_ui.test b/modules/tax/tests/commerce_tax_ui.test index a988745e..56588a95 100644 --- a/modules/tax/tests/commerce_tax_ui.test +++ b/modules/tax/tests/commerce_tax_ui.test @@ -14,6 +14,8 @@ class CommerceTaxUIAdminTest extends CommerceBaseTestCase { * Normal user (without admin or store permissions) for testing. */ protected $normal_user; + protected $store_admin; + protected $site_admin; /** * Tax type. @@ -40,6 +42,7 @@ class CommerceTaxUIAdminTest extends CommerceBaseTestCase { // User creation for different operations. $this->store_admin = $this->createStoreAdmin(); + $this->site_admin = $this->createSiteAdmin(); $this->normal_user = $this->backdropCreateUser(array('access checkout', 'view own commerce_order entities')); // Create a dummy tax type for testing. @@ -599,13 +602,17 @@ class CommerceTaxUIAdminTest extends CommerceBaseTestCase { // Create a tax rate VAT Type. $tax_rate = $this->createDummyTaxRate(array('type' => 'vat')); - // Create a new product and product display. - $product_type = $this->createDummyProductDisplayContentType(); - $this->backdropGet('admin/structure/types/manage/' . $product_type->name . '/display/default'); $product = $this->createDummyProduct(); $product_wrapper = entity_metadata_wrapper('commerce_product', $product); $product_node = $this->createDummyProductNode(array($product->product_id)); + // Create a new product and product display. + $product_type = $this->createDummyProductDisplayContentType(); + + $this->backdropLogin($this->site_admin); + $this->backdropGet('admin/structure/types/manage/' . $product_type->name . '/fields'); + + //$this->backdropLogout(); // Login with normal user. $this->backdropLogin($this->normal_user); @@ -616,6 +623,7 @@ class CommerceTaxUIAdminTest extends CommerceBaseTestCase { $products = commerce_product_load_multiple(array($product->product_id), array(), TRUE); $product = reset($products); $price_component = commerce_product_calculate_sell_price($product); + $this->assertText(trim(commerce_currency_format($price_component['amount'], $price_component['currency_code'])), t('Amount with taxes corresponds with the amount displayed in the product display page')); $components = commerce_price_component_load($price_component, $tax_rate['price_component']); $tax_component = reset($components); @@ -629,12 +637,14 @@ class CommerceTaxUIAdminTest extends CommerceBaseTestCase { // Create a tax rate VAT Type. $tax_rate = $this->createDummyTaxRate(array('type' => 'vat')); - // Create a new product and product display. - $product_type = $this->createDummyProductDisplayContentType(); - $this->backdropGet('admin/structure/types/manage/' . $product_type->name . '/display/default'); $product = $this->createDummyProduct(); $product_node = $this->createDummyProductNode(array($product->product_id)); + // Create a new product and product display. + $product_type = $this->createDummyProductDisplayContentType(); + $this->backdropLogin($this->site_admin); + $this->backdropGet('admin/structure/types/manage/' . $product_type->name . '/fields'); + // Login with store admin user. $this->backdropLogin($this->store_admin); From 98fce97c1ec60703176db8f1ac12324f7168de64 Mon Sep 17 00:00:00 2001 From: Eli Lisseck Date: Wed, 22 Oct 2025 14:08:14 -0700 Subject: [PATCH 2/6] Update tests to php8.3 --- .github/workflows/functional-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/functional-tests.yml b/.github/workflows/functional-tests.yml index 199d232c..089be585 100644 --- a/.github/workflows/functional-tests.yml +++ b/.github/workflows/functional-tests.yml @@ -8,7 +8,7 @@ jobs: - name: Setup env run: | echo "REPO_NAME=${PWD##*/}" >> $GITHUB_ENV - echo 'USE_PHP_V=8.2' >> $GITHUB_ENV + echo 'USE_PHP_V=8.3' >> $GITHUB_ENV - name: Install MariaDB uses: shogo82148/actions-setup-mysql@v1 From 339b4648802e2c485632ec279235c965603bb4af Mon Sep 17 00:00:00 2001 From: Eli Lisseck Date: Wed, 22 Oct 2025 18:07:09 -0700 Subject: [PATCH 3/6] Entity Plus and Entity Tokens integrations do not test well with a "minimal" profile install. --- tests/commerce_base.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/commerce_base.test b/tests/commerce_base.test index 489244b1..880a0b13 100644 --- a/tests/commerce_base.test +++ b/tests/commerce_base.test @@ -16,7 +16,7 @@ class CommerceBaseTestCase extends BackdropWebTestCase { protected $store_customer; protected $fields; protected $checkout_url; - protected $profile = 'minimal'; + protected $profile = 'standard'; protected $product; protected $product_node; protected $other_user; From 735f162708b56c0b4ed76ccbfde1de8ce031ac99 Mon Sep 17 00:00:00 2001 From: Eli Lisseck Date: Fri, 24 Oct 2025 10:10:44 -0700 Subject: [PATCH 4/6] Get backdrop from elisseck/backdrop repo for tests temporarily, so we can make useful core changes to test output. --- .github/workflows/functional-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/functional-tests.yml b/.github/workflows/functional-tests.yml index 089be585..99a1b51c 100644 --- a/.github/workflows/functional-tests.yml +++ b/.github/workflows/functional-tests.yml @@ -33,7 +33,7 @@ jobs: - name: Checkout Backdrop core uses: actions/checkout@v4 with: - repository: backdrop/backdrop + repository: elisseck/backdrop - name: Checkout dependency entity_plus uses: actions/checkout@v4 From 1111e8929304f02e7cccf6c62a1f83b0201445db Mon Sep 17 00:00:00 2001 From: Eli Lisseck Date: Fri, 24 Oct 2025 11:43:16 -0700 Subject: [PATCH 5/6] Resolve entityQuery property reference issue from d7 on commerce product reference field deletion. This is a common issue in ports from d7 to backdrop using entity queries that was missed. Move the tests back to using backdrop/backdrop repository. --- .github/workflows/functional-tests.yml | 2 +- modules/product_reference/commerce_product_reference.module | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/functional-tests.yml b/.github/workflows/functional-tests.yml index 99a1b51c..089be585 100644 --- a/.github/workflows/functional-tests.yml +++ b/.github/workflows/functional-tests.yml @@ -33,7 +33,7 @@ jobs: - name: Checkout Backdrop core uses: actions/checkout@v4 with: - repository: elisseck/backdrop + repository: backdrop/backdrop - name: Checkout dependency entity_plus uses: actions/checkout@v4 diff --git a/modules/product_reference/commerce_product_reference.module b/modules/product_reference/commerce_product_reference.module index df047ed2..372f5f3e 100644 --- a/modules/product_reference/commerce_product_reference.module +++ b/modules/product_reference/commerce_product_reference.module @@ -279,7 +279,7 @@ function commerce_product_reference_form_commerce_product_product_delete_form_al if ($entity_type == 'commerce_line_item') { // Load the referencing line item. $line_item = reset($data); - $line_item = commerce_line_item_load($line_item->line_item_id); + $line_item = commerce_line_item_load($line_item->entity_id); // Implement a soft dependency on the Order module to show a little // more information in the non-deletion message. From 0fc18c3e756b89fb8c1b1c304692db35cb2ce9f3 Mon Sep 17 00:00:00 2001 From: Eli Lisseck Date: Fri, 24 Oct 2025 13:09:51 -0700 Subject: [PATCH 6/6] Fix commerce product ui test for deletion message when an order is associated with a product. The message can either have an order ID or not, and both cases seem like they can happen depending on the testing database so the string check has been split into two. --- modules/product/tests/commerce_product_ui.test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/product/tests/commerce_product_ui.test b/modules/product/tests/commerce_product_ui.test index 80d40609..a40e1d44 100644 --- a/modules/product/tests/commerce_product_ui.test +++ b/modules/product/tests/commerce_product_ui.test @@ -326,7 +326,8 @@ class CommerceProductUIAdminTest extends CommerceBaseTestCase { $this->backdropGet('admin/commerce/products/' . $product->product_id . '/delete'); $this->pass('Assertions for trying to delete a product associated to a line item:'); - $this->assertText(t('This product is referenced by a line item and therefore cannot be deleted. Disable it instead.', array('@order_num' => $order->order_id)), t('Product delete restriction message is displayed correctly')); + $this->assertText(t('This product is referenced by a line item', array('@order_num' => $order->order_id)), t('Product delete restriction message is displayed correctly')); + $this->assertText(t('and therefore cannot be deleted. Disable it instead.', array('@order_num' => $order->order_id)), t('Product delete restriction message is displayed correctly')); $this->assertFieldByXPath('//input[@id="edit-submit" and @disabled="disabled"]', NULL, t('Delete button is present and is disabled')); }