Commit 708bc8f9f37 for woocommerce

commit 708bc8f9f37d6a132ae78d8edc448988065ceec8
Author: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Date:   Tue Jul 14 14:32:20 2026 +0300

    Fix CSV importer image unit tests broken by concurrent merge (#66595)

    php tests: restore importer instance in CSV importer image tests

    The two gallery-image tests referenced $this->sut, a property removed by
    a concurrent change (#66522) after this PR's base. Build a local importer
    in each test instead.

diff --git a/plugins/woocommerce/changelog/fix-csv-importer-image-tests b/plugins/woocommerce/changelog/fix-csv-importer-image-tests
new file mode 100644
index 00000000000..40454787e00
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-csv-importer-image-tests
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Fix CSV importer image unit tests that referenced an importer property removed by a concurrent change.
diff --git a/plugins/woocommerce/tests/legacy/unit-tests/importer/product.php b/plugins/woocommerce/tests/legacy/unit-tests/importer/product.php
index 050362a92fe..0254d59ed8c 100644
--- a/plugins/woocommerce/tests/legacy/unit-tests/importer/product.php
+++ b/plugins/woocommerce/tests/legacy/unit-tests/importer/product.php
@@ -245,8 +245,9 @@ class WC_Tests_Product_CSV_Importer extends WC_Unit_Test_Case {
 		$product->set_gallery_image_ids( array( $gallery_id ) );
 		$product->save();

-		$expanded = $this->invoke_protected( $this->sut, 'expand_data', array( array( 'images' => array( $new_url ) ) ) );
-		$this->invoke_protected( $this->sut, 'set_image_data', array( &$product, $expanded ) );
+		$importer = new WC_Product_CSV_Importer( $this->csv_file, array( 'parse' => false ) );
+		$expanded = $this->invoke_protected( $importer, 'expand_data', array( array( 'images' => array( $new_url ) ) ) );
+		$this->invoke_protected( $importer, 'set_image_data', array( &$product, $expanded ) );

 		$this->assertEquals( $new_id, $product->get_image_id(), 'Featured image should be replaced with the new image.' );
 		$this->assertEquals( array(), $product->get_gallery_image_ids(), 'Removed gallery images should be cleared.' );
@@ -267,8 +268,9 @@ class WC_Tests_Product_CSV_Importer extends WC_Unit_Test_Case {
 		$product->set_gallery_image_ids( array( $gallery_id ) );
 		$product->save();

-		$expanded = $this->invoke_protected( $this->sut, 'expand_data', array( array( 'images' => array() ) ) );
-		$this->invoke_protected( $this->sut, 'set_image_data', array( &$product, $expanded ) );
+		$importer = new WC_Product_CSV_Importer( $this->csv_file, array( 'parse' => false ) );
+		$expanded = $this->invoke_protected( $importer, 'expand_data', array( array( 'images' => array() ) ) );
+		$this->invoke_protected( $importer, 'set_image_data', array( &$product, $expanded ) );

 		$this->assertEquals( $featured_id, $product->get_image_id(), 'Featured image should be preserved.' );
 		$this->assertEquals( array( $gallery_id ), $product->get_gallery_image_ids(), 'Existing gallery should be preserved.' );