refactor(stock): implement expiration for stock reservations and add configuration
This commit is contained in:
@@ -80,6 +80,30 @@ class CartControllerTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_it_sets_the_configured_expiration_when_creating_a_stock_reservation(): void
|
||||
{
|
||||
config()->set('catalog.stock_reservation_expiration_minutes', 45);
|
||||
$now = now()->startOfSecond();
|
||||
$this->travelTo($now);
|
||||
|
||||
$tenant = $this->createTenant('acme');
|
||||
$item = $this->createDirectItem($tenant, 10, '49.90');
|
||||
|
||||
$this->postJson('/api/tenants/acme/cart/items', [
|
||||
'catalog_item_id' => $item->id,
|
||||
'cantidad' => 2,
|
||||
])->assertOk();
|
||||
|
||||
$this->assertDatabaseHas('stock_reservations', [
|
||||
'inventory_id' => $item->inventory_id,
|
||||
'quantity' => 2,
|
||||
'status' => 'active',
|
||||
'expires_at' => $now->copy()->addMinutes(45)->toDateTimeString(),
|
||||
]);
|
||||
|
||||
$this->travelBack();
|
||||
}
|
||||
|
||||
public function test_it_filters_item_images_when_the_tenant_disables_them(): void
|
||||
{
|
||||
$tenant = $this->createTenant('acme');
|
||||
|
||||
Reference in New Issue
Block a user