Skip to content

Commit 4c102ae

Browse files
committed
[TASK] Cover synchronous fallback when the queue table is missing
1 parent d5c6022 commit 4c102ae

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Tests/Functional/EventListener/AfterFileProcessingFunctionalTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,24 @@ public function asyncSkipsEnqueueWhenWebpAlreadyCurrent(): void
223223
self::assertSame(0, $queueRows, 'Existing current webp must not be re-enqueued');
224224
}
225225

226+
#[Test]
227+
public function fallsBackToSynchronousConversionWhenQueueTableMissing(): void
228+
{
229+
// Upgrade install with async enabled but the DB analyzer not yet run:
230+
// tx_webp_queue is absent, enqueue() throws, and the listener must
231+
// convert synchronously instead of silently dropping the conversion.
232+
$this->applyConfigOverride('async', '1');
233+
$this->getConnectionPool()
234+
->getConnectionForTable('tx_webp_queue')
235+
->executeStatement('DROP TABLE tx_webp_queue');
236+
237+
$file = $this->getFile(1);
238+
$processed = $file->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, ['width' => 16, 'height' => 16]);
239+
240+
self::assertFileExists($processed->getForLocalProcessing(false) . '.webp', 'sync fallback must still produce the webp sibling');
241+
self::assertSame(1, $this->countWebpRowsForOriginal((int) $file->getUid()), 'sync fallback must finalize the processed-file row');
242+
}
243+
226244
protected function setUp(): void
227245
{
228246
parent::setUp();

0 commit comments

Comments
 (0)