Handle Woo plugin connection timeouts without 500 errors.
Deploy Ladill Woo Manager / deploy (push) Successful in 1m4s
Deploy Ladill Woo Manager / deploy (push) Successful in 1m4s
Treat unreachable WordPress stores as unavailable during integrations refresh instead of throwing when the site times out. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -143,4 +143,31 @@ class WooIntegrationsTest extends TestCase
|
||||
Http::assertSentCount(2);
|
||||
$this->assertTrue(Cache::has('woo.integrations.'.$store->id));
|
||||
}
|
||||
|
||||
public function test_integrations_refresh_survives_store_connection_timeout(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
WooStore::create([
|
||||
'user_id' => $user->id,
|
||||
'site_url' => 'https://shop.example.com',
|
||||
'site_name' => 'Example Shop',
|
||||
'status' => WooStore::STATUS_ACTIVE,
|
||||
'connected_at' => now(),
|
||||
'public_id' => 'store-public-id',
|
||||
]);
|
||||
|
||||
Http::fake([
|
||||
'https://shop.example.com/wp-json/ladill-woo/v1/integrations/status' => function () {
|
||||
throw new \Illuminate\Http\Client\ConnectionException(
|
||||
new \Exception('cURL error 28: Operation timed out')
|
||||
);
|
||||
},
|
||||
]);
|
||||
|
||||
$this->actingAs($user)
|
||||
->from(route('woo.integrations.index'))
|
||||
->post(route('woo.integrations.refresh'))
|
||||
->assertRedirect(route('woo.integrations.index'))
|
||||
->assertSessionHas('success');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user