Revert "feat(variants): implement restoration of previously suspended variants with usable dates"
This reverts commit 3a4f6b64d2.
This commit is contained in:
@@ -11,7 +11,6 @@ use App\Domains\Catalog\Models\Inventory;
|
||||
use App\Domains\Catalog\Models\StockReservation;
|
||||
use App\Domains\Catalog\Models\StockReservationLine;
|
||||
use App\Domains\Catalog\Models\Variant;
|
||||
use App\Domains\Catalog\Services\VariantReplacementService;
|
||||
use App\Domains\Event\Events\EventDateRescheduled;
|
||||
use App\Domains\Event\Events\EventDateSuspended;
|
||||
use App\Domains\Purchase\Services\Checkout\CatalogSelectionResolver;
|
||||
@@ -576,36 +575,6 @@ class AdminAppEventControllerTest extends TestCase
|
||||
$this->assertFalse($ticket->fresh()->resolvedValidity()->isResolvable);
|
||||
}
|
||||
|
||||
public function test_previous_suspensions_restore_variants_with_usable_dates(): void
|
||||
{
|
||||
$tenant = $this->createTenant('acme');
|
||||
$suspendedDate = $tenant->eventDates()->create([
|
||||
'date' => '2027-10-09',
|
||||
'time_start' => '09:00',
|
||||
'time_end' => '18:30',
|
||||
'suspended_at' => now(),
|
||||
]);
|
||||
$usableDate = $tenant->eventDates()->create([
|
||||
'date' => '2027-10-10',
|
||||
'time_start' => '09:00',
|
||||
'time_end' => '18:30',
|
||||
]);
|
||||
$variant = $this->createVariant($tenant);
|
||||
$variant->eventDates()->sync([$suspendedDate->id, $usableDate->id]);
|
||||
$variant->inventory->update(['real_stock' => 5]);
|
||||
$variant->update(['sales_disabled_at' => now()]);
|
||||
|
||||
$service = app(VariantReplacementService::class);
|
||||
$this->assertSame(1, $service->restorePreviouslySuspendedVariants());
|
||||
$this->assertSame(0, $service->restorePreviouslySuspendedVariants());
|
||||
|
||||
$replacement = $variant->fresh()->replacement;
|
||||
$this->assertNotNull($replacement);
|
||||
$this->assertSame([$usableDate->id], $replacement->selectedEventDates()->pluck('id')->all());
|
||||
$this->assertSame(5, $replacement->inventory->availableStock());
|
||||
$this->assertTrue(CatalogItem::query()->whereKey($variant->catalog_item_id)->whereAvailable()->exists());
|
||||
}
|
||||
|
||||
public function test_update_and_date_creation_validate_their_own_payloads(): void
|
||||
{
|
||||
$tenant = $this->createTenant('acme');
|
||||
|
||||
Reference in New Issue
Block a user