Commit 8cecd622eb3 for woocommerce
commit 8cecd622eb3cfef4dd07031e157d7e833274bb60
Author: malinajirka <malinajirka@gmail.com>
Date: Wed Jul 8 11:51:59 2026 +0200
Fix AsyncGenerator lock test to exercise FeedLockException path (#66249)
* Fix AsyncGenerator lock test to exercise FeedLockException path
The integration test test_feed_generation_steps_aside_when_feed_file_is_locked
assigned $identifier = $holder->start(), but start() returns void. The null
identifier was stored as file_name, so feed_generation_action() bailed early at
the "empty file_name" continuation guard, never reaching the FeedLockException
catch the test was written to cover. Its assertions passed trivially because the
early return also leaves the status untouched.
Use $holder->open() to obtain the real identifier so the duplicate run hits the
held lock and exercises the intended step-aside path.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Update plugins/woocommerce/tests/php/src/Internal/ProductFeed/Integrations/POSCatalog/AsyncGeneratorTest.php
Co-authored-by: Jaclyn Chen <watertranquil@gmail.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Jaclyn Chen <watertranquil@gmail.com>
diff --git a/plugins/woocommerce/changelog/66228-fix-async-generator-lock-test b/plugins/woocommerce/changelog/66228-fix-async-generator-lock-test
new file mode 100644
index 00000000000..a8fcbfbfb65
--- /dev/null
+++ b/plugins/woocommerce/changelog/66228-fix-async-generator-lock-test
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Fix POS catalog AsyncGenerator integration test to actually exercise the FeedLockException path by opening the feed with open() instead of start() (which returns void).
diff --git a/plugins/woocommerce/tests/php/src/Internal/ProductFeed/Integrations/POSCatalog/AsyncGeneratorTest.php b/plugins/woocommerce/tests/php/src/Internal/ProductFeed/Integrations/POSCatalog/AsyncGeneratorTest.php
index f63a2fa0472..ff873f0f6bd 100644
--- a/plugins/woocommerce/tests/php/src/Internal/ProductFeed/Integrations/POSCatalog/AsyncGeneratorTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/ProductFeed/Integrations/POSCatalog/AsyncGeneratorTest.php
@@ -715,9 +715,9 @@ class AsyncGeneratorTest extends \WC_Unit_Test_Case {
fn() => new JsonFileFeed( 'pos-catalog-feed-test' )
);
- // Simulate the original process: start a feed and keep its exclusive lock held (no flush/end).
+ // Simulate the original process: open a feed and keep its exclusive lock held (no flush/end).
$holder = new JsonFileFeed( 'pos-catalog-feed-test' );
- $identifier = $holder->start();
+ $identifier = $holder->open();
$partial_path = wp_upload_dir()['basedir'] . '/' . JsonFileFeed::UPLOAD_DIR . '/' . $identifier;
$this->assertTrue( file_exists( $partial_path ) );