Refactor ticket validity handling and improve tests

- Updated tests for Accommodation, Entry, Food, Merchandise, and Sale controllers to use soft deletes for variants and ensure proper inventory counts.
- Enhanced ticket generation logic to resolve validity from soft-deleted catalog sources.
- Introduced a new TicketValidityResolver service to manage ticket validity based on event dates and variant definitions.
- Removed unnecessary database assertions and improved the clarity of validity checks in tests.
- Added comprehensive tests for the new TicketValidityResolver service, ensuring correct handling of event dates and multi-select options.
- Cleaned up unused code and assertions in existing tests for better maintainability.
This commit is contained in:
2026-08-14 09:00:51 -03:00
parent bfdaf1c38b
commit 573d4fe5e6
59 changed files with 1185 additions and 679 deletions

View File

@@ -287,7 +287,7 @@ class BundleCatalogItemTest extends TestCase
->assertJsonValidationErrors(['real_stock']);
}
public function test_bundle_components_are_deleted_with_the_bundle(): void
public function test_bundle_components_are_preserved_when_the_bundle_is_soft_deleted(): void
{
$component = $this->createStandardItem('deletion-component', 5);
$bundle = $this->createBundle('deletable-bundle', [
@@ -295,8 +295,8 @@ class BundleCatalogItemTest extends TestCase
]);
$this->catalogService->delete($bundle);
$this->assertDatabaseMissing('catalog_items', ['id' => $bundle->id]);
$this->assertDatabaseMissing('bundle_components', [
$this->assertSoftDeleted('catalog_items', ['id' => $bundle->id]);
$this->assertDatabaseHas('bundle_components', [
'bundle_catalog_item_id' => $bundle->id,
]);
$this->assertDatabaseHas('catalog_items', ['id' => $component->id]);