bin
3 months ago
fixtures
3 months ago
AdminCodeCleanupAndPDFTest.php
3 months ago
AdminCodesByProductTest.php
3 months ago
AdminCustomerNameTest.php
3 months ago
AdminErrorLogTest.php
3 months ago
AdminFormatWarningTest.php
3 months ago
AdminListAndCodeOpsTest.php
3 months ago
AdminListQueryTest.php
3 months ago
AdminMetaAndErrorTest.php
3 months ago
AdminOptionsAndMigrationTest.php
3 months ago
AdminOrderInfoTest.php
3 months ago
AdminRedeemAmountTest.php
3 months ago
AdminRestrictionAndRstrTest.php
3 months ago
AdminSettingsAndDatepickerTest.php
3 months ago
AdminSettingsCodeTest.php
3 months ago
AdminTicketInfoTest.php
3 months ago
AdminTimezoneAndMiscTest.php
3 months ago
AdminWCCodeOpsTest.php
3 months ago
AuthtokenAccessTest.php
3 months ago
AuthtokenCRUDTest.php
3 months ago
AuthtokenEditAndRemoveTest.php
3 months ago
AuthtokenTest.php
3 months ago
BaseLimitsTest.php
3 months ago
CartCodeRestrictionAndAssignTest.php
3 months ago
CartMetaAndBeforeCartTest.php
3 months ago
CartValidationTest.php
3 months ago
ContextWizardTest.php
3 months ago
CoreAlignAndSearchTest.php
3 months ago
CoreCodeOpsAndDBLogTest.php
3 months ago
CoreDecodeAndReplaceTest.php
3 months ago
CoreEncodeMetaTest.php
3 months ago
CoreExpiredAndRegisteredTest.php
3 months ago
CoreMetaAndUrlTest.php
3 months ago
CoreMetaObjectStructureTest.php
3 months ago
CoreMetaTest.php
3 months ago
CoreMethodsTest.php
3 months ago
CoreOrderAndIPTest.php
3 months ago
CoreParserAndQueryTest.php
3 months ago
CoreParserURLAndMergePDFTest.php
3 months ago
CoreReplaceAndExpireTest.php
3 months ago
CoreTicketIdAndExpirationTest.php
3 months ago
CoreTicketIdAndUrlTest.php
3 months ago
CoreTicketURLComponentsTest.php
3 months ago
CountRedeemsTodayTest.php
3 months ago
CronjobTest.php
3 months ago
DBOperationsTest.php
3 months ago
DBSanitizeAndQueryTest.php
3 months ago
DBSanitizeTest.php
3 months ago
DBTablesAndUpdateTest.php
3 months ago
DatabaseTest.php
3 months ago
DateCalcAndCorrectProductTest.php
3 months ago
DaychooserTest.php
3 months ago
EmailHandlerTest.php
3 months ago
EmailOrderMetaAndAttachmentsTest.php
3 months ago
ErrorLogAndSanitizeTest.php
3 months ago
EventTimeWindowTest.php
3 months ago
FrontendCheckCodeTest.php
3 months ago
FrontendCountConfirmedTest.php
3 months ago
FrontendExecuteJSONAndCheckCodeTest.php
3 months ago
FrontendIsUsedAndOptionsTest.php
3 months ago
FrontendMarkUsedTest.php
3 months ago
FrontendValidationTest.php
3 months ago
FullTicketFlowTest.php
3 months ago
HelpersTest.php
3 months ago
ListManagementTest.php
3 months ago
MaxRedeemPerDayTest.php
3 months ago
MessengerAndRESTEndpointsTest.php
3 months ago
MessengerTypeCheckTest.php
3 months ago
OldPremiumGuardTest.php
3 months ago
OneTimeUseTest.php
3 months ago
OptionsChangeAndLoadTest.php
3 months ago
OptionsDeleteAndResetTest.php
3 months ago
OptionsExportImportTest.php
3 months ago
OptionsFormatsTest.php
3 months ago
OptionsHistoryTest.php
3 months ago
OptionsMigrationTest.php
3 months ago
OptionsResetAndFormatTest.php
3 months ago
OptionsTest.php
3 months ago
OrderDeleteAndRefundDeleteTest.php
3 months ago
OrderMetaKeyValueDisplayTest.php
3 months ago
OrderStatusHandlerTest.php
3 months ago
OrderTicketGenerationTest.php
3 months ago
OrderTicketQueryTest.php
3 months ago
PDFAndQRConfigTest.php
3 months ago
PDFMergeAndPWAServiceWorkerTest.php
3 months ago
PDFSettersTest.php
3 months ago
PDFSettingsTest.php
3 months ago
PDFUtilsTest.php
3 months ago
PWAManifestAndSessionTest.php
3 months ago
PartialRefundAndCodeCleanupTest.php
3 months ago
PluginInitAndShortcodeTest.php
3 months ago
ProductSettingsTest.php
3 months ago
QRCodeAndDesignerTest.php
3 months ago
QRPDFAndBadgePDFTest.php
3 months ago
RESTRoutesAndPingTest.php
3 months ago
RefundTest.php
3 months ago
RestApiTest.php
3 months ago
RestApiTicketTest.php
3 months ago
ScannerBoilerplateAndFormatWarningsTest.php
3 months ago
SeatingBlockTest.php
3 months ago
SeatingCoordinatorTest.php
3 months ago
SeatingExportTest.php
3 months ago
SeatingMetaTest.php
3 months ago
SeatingPlanCRUDTest.php
3 months ago
SeatingPlanTest.php
3 months ago
SeatingSeatCRUDTest.php
3 months ago
SetupWizardTest.php
3 months ago
ShortcodeAndCartCheckTest.php
3 months ago
ShortcodeAndCodesDisplayTest.php
3 months ago
ShortcodesAndCodeListTest.php
3 months ago
StaticDateAndTimeTest.php
3 months ago
StaticHelpersAndMessengerTest.php
3 months ago
StaticUtilMethodsTest.php
3 months ago
TicketBadgeTemplateTest.php
3 months ago
TicketCalcDateTest.php
3 months ago
TicketDesignerAndBadgeTest.php
3 months ago
TicketDesignerTemplateTest.php
3 months ago
TicketDesignerTest.php
3 months ago
TicketDisplayTest.php
3 months ago
TicketExpirationAndICSTest.php
3 months ago
TicketLabelAndDisplayTest.php
3 months ago
TicketLabelsAndStaticsTest.php
3 months ago
TicketQRSettersTest.php
3 months ago
TicketRedeemTest.php
3 months ago
TicketRoutingTest.php
3 months ago
TicketScannerMethodsTest.php
3 months ago
TicketSettersAndOrderTest.php
3 months ago
TicketUtilAndICSTest.php
3 months ago
TicketUtilMethodsTest.php
3 months ago
TicketWPMLAndSubscriptionTest.php
3 months ago
TimezoneRedeemBlockingTest.php
3 months ago
UrlParsingTest.php
3 months ago
VariationTicketTest.php
3 months ago
WCBaseMetaConstantsTest.php
3 months ago
WCCheckoutCartFlowTest.php
3 months ago
WCEmailAttachmentTest.php
3 months ago
WCFrontendAjaxAndDatepickerTest.php
3 months ago
WCFrontendCartHandlerTest.php
3 months ago
WCFrontendCartHandlersTest.php
3 months ago
WCFrontendCartTest.php
3 months ago
WCFrontendCartValidationTest.php
3 months ago
WCFrontendHandlersTest.php
3 months ago
WCFrontendLabelsTest.php
3 months ago
WCFrontendMethodsTest.php
3 months ago
WCOrderDeleteTest.php
3 months ago
WCOrderDisplayMetaTest.php
3 months ago
WCOrderHasTicketsTest.php
3 months ago
WCOrderHooksTest.php
3 months ago
WCOrderItemMetaDisplayTest.php
3 months ago
WCOrderItemOpsTest.php
3 months ago
WCOrderLifecycleTest.php
3 months ago
WCOrderMethodsTest.php
3 months ago
WCOrderTicketDetectionTest.php
3 months ago
WCOrderTicketNumberTest.php
3 months ago
WCProductAndVariationTest.php
3 months ago
WCProductColumnsTest.php
3 months ago
WCProductConfigAndColumnsTest.php
3 months ago
WCProductIsTicketAndListsTest.php
3 months ago
WCProductMetaSaveTest.php
3 months ago
WCProductMethodsTest.php
3 months ago
WCProductTabsAndSideBoxTest.php
3 months ago
WCProductTicketTest.php
3 months ago
WebhooksAndMigrationTest.php
3 months ago
bootstrap.php
3 months ago
composer.json
3 months ago
phpunit.xml
3 months ago
test-premium-compat.sh
3 months ago
TicketDisplayTest.php
340 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Tests for ticket display methods (displayTicketDateAsString, labels, ICS generation, redeem amount text). |
| 4 | */ |
| 5 | |
| 6 | class TicketDisplayTest extends WP_UnitTestCase { |
| 7 | |
| 8 | private $main; |
| 9 | |
| 10 | public function set_up(): void { |
| 11 | parent::set_up(); |
| 12 | $this->main = sasoEventtickets::Instance(); |
| 13 | |
| 14 | if (!class_exists('WC_Product_Simple')) { |
| 15 | $this->markTestSkipped('WooCommerce not available'); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Helper: create a ticket product with dates. |
| 21 | */ |
| 22 | private function createTicketProductWithDates(array $meta = []): WC_Product_Simple { |
| 23 | $listId = $this->main->getDB()->insert('lists', [ |
| 24 | 'name' => 'Display List ' . uniqid(), |
| 25 | 'aktiv' => 1, |
| 26 | 'meta' => '{}', |
| 27 | ]); |
| 28 | |
| 29 | $product = new WC_Product_Simple(); |
| 30 | $product->set_name('Display Test Product'); |
| 31 | $product->set_regular_price('10.00'); |
| 32 | $product->set_status('publish'); |
| 33 | $product->save(); |
| 34 | $pid = $product->get_id(); |
| 35 | |
| 36 | update_post_meta($pid, 'saso_eventtickets_is_ticket', 'yes'); |
| 37 | update_post_meta($pid, 'saso_eventtickets_list', $listId); |
| 38 | |
| 39 | foreach ($meta as $key => $value) { |
| 40 | update_post_meta($pid, $key, $value); |
| 41 | } |
| 42 | |
| 43 | return $product; |
| 44 | } |
| 45 | |
| 46 | // ── displayTicketDateAsString ───────────────────────────────── |
| 47 | |
| 48 | public function test_displayTicketDateAsString_full_date_and_time(): void { |
| 49 | $product = $this->createTicketProductWithDates([ |
| 50 | 'saso_eventtickets_ticket_start_date' => '2026-07-01', |
| 51 | 'saso_eventtickets_ticket_start_time' => '18:00:00', |
| 52 | 'saso_eventtickets_ticket_end_date' => '2026-07-01', |
| 53 | 'saso_eventtickets_ticket_end_time' => '23:00:00', |
| 54 | ]); |
| 55 | |
| 56 | $ticket = $this->main->getTicketHandler(); |
| 57 | $result = $ticket->displayTicketDateAsString($product->get_id()); |
| 58 | |
| 59 | $this->assertStringContainsString('2026', $result); |
| 60 | $this->assertStringContainsString('18:00', $result); |
| 61 | $this->assertStringContainsString('23:00', $result); |
| 62 | $this->assertStringContainsString(' - ', $result); |
| 63 | } |
| 64 | |
| 65 | public function test_displayTicketDateAsString_only_start_date(): void { |
| 66 | $product = $this->createTicketProductWithDates([ |
| 67 | 'saso_eventtickets_ticket_start_date' => '2026-12-25', |
| 68 | ]); |
| 69 | |
| 70 | $ticket = $this->main->getTicketHandler(); |
| 71 | $result = $ticket->displayTicketDateAsString($product->get_id()); |
| 72 | |
| 73 | $this->assertStringContainsString('2026', $result); |
| 74 | $this->assertStringContainsString('12', $result); |
| 75 | } |
| 76 | |
| 77 | public function test_displayTicketDateAsString_no_dates_returns_string(): void { |
| 78 | $product = $this->createTicketProductWithDates([]); |
| 79 | |
| 80 | $ticket = $this->main->getTicketHandler(); |
| 81 | $result = $ticket->displayTicketDateAsString($product->get_id()); |
| 82 | |
| 83 | // May return non-empty string with default/zero dates |
| 84 | $this->assertIsString($result); |
| 85 | } |
| 86 | |
| 87 | public function test_displayTicketDateAsString_invalid_product_throws(): void { |
| 88 | $this->expectException(Exception::class); |
| 89 | $this->main->getTicketHandler()->displayTicketDateAsString(0); |
| 90 | } |
| 91 | |
| 92 | public function test_displayTicketDateAsString_custom_format(): void { |
| 93 | $product = $this->createTicketProductWithDates([ |
| 94 | 'saso_eventtickets_ticket_start_date' => '2026-03-15', |
| 95 | 'saso_eventtickets_ticket_start_time' => '09:30:00', |
| 96 | ]); |
| 97 | |
| 98 | $ticket = $this->main->getTicketHandler(); |
| 99 | $result = $ticket->displayTicketDateAsString($product->get_id(), 'd.m.Y', 'H:i'); |
| 100 | |
| 101 | $this->assertStringContainsString('15.03.2026', $result); |
| 102 | $this->assertStringContainsString('09:30', $result); |
| 103 | } |
| 104 | |
| 105 | // ── displayDayChooserDateAsString ───────────────────────────── |
| 106 | |
| 107 | public function test_displayDayChooserDateAsString_null_returns_empty(): void { |
| 108 | $ticket = $this->main->getTicketHandler(); |
| 109 | $result = $ticket->displayDayChooserDateAsString(null); |
| 110 | $this->assertEmpty($result); |
| 111 | } |
| 112 | |
| 113 | public function test_displayDayChooserDateAsString_non_daychooser_returns_empty(): void { |
| 114 | $listId = $this->main->getDB()->insert('lists', [ |
| 115 | 'name' => 'DC Display ' . uniqid(), |
| 116 | 'aktiv' => 1, |
| 117 | 'meta' => '{}', |
| 118 | ]); |
| 119 | |
| 120 | $metaObj = $this->main->getCore()->getMetaObject(); |
| 121 | $metaObj['wc_ticket']['is_daychooser'] = 0; |
| 122 | $metaJson = $this->main->getCore()->json_encode_with_error_handling($metaObj); |
| 123 | |
| 124 | $code = 'DCD' . strtoupper(uniqid()); |
| 125 | $this->main->getDB()->insert('codes', [ |
| 126 | 'code' => $code, |
| 127 | 'code_display' => $code, |
| 128 | 'cvv' => '', |
| 129 | 'meta' => $metaJson, |
| 130 | 'aktiv' => 1, |
| 131 | 'redeemed' => 0, |
| 132 | 'list_id' => $listId, |
| 133 | 'order_id' => 0, |
| 134 | ]); |
| 135 | |
| 136 | $codeObj = $this->main->getCore()->retrieveCodeByCode($code); |
| 137 | $result = $this->main->getTicketHandler()->displayDayChooserDateAsString($codeObj); |
| 138 | $this->assertEmpty($result); |
| 139 | } |
| 140 | |
| 141 | public function test_displayDayChooserDateAsString_with_day_per_ticket(): void { |
| 142 | $listId = $this->main->getDB()->insert('lists', [ |
| 143 | 'name' => 'DC With Day ' . uniqid(), |
| 144 | 'aktiv' => 1, |
| 145 | 'meta' => '{}', |
| 146 | ]); |
| 147 | |
| 148 | $metaObj = $this->main->getCore()->getMetaObject(); |
| 149 | $metaObj['wc_ticket']['is_daychooser'] = 1; |
| 150 | $metaObj['wc_ticket']['day_per_ticket'] = '2026-06-15'; |
| 151 | $metaJson = $this->main->getCore()->json_encode_with_error_handling($metaObj); |
| 152 | |
| 153 | $code = 'DCW' . strtoupper(uniqid()); |
| 154 | $this->main->getDB()->insert('codes', [ |
| 155 | 'code' => $code, |
| 156 | 'code_display' => $code, |
| 157 | 'cvv' => '', |
| 158 | 'meta' => $metaJson, |
| 159 | 'aktiv' => 1, |
| 160 | 'redeemed' => 0, |
| 161 | 'list_id' => $listId, |
| 162 | 'order_id' => 0, |
| 163 | ]); |
| 164 | |
| 165 | $codeObj = $this->main->getCore()->retrieveCodeByCode($code); |
| 166 | $result = $this->main->getTicketHandler()->displayDayChooserDateAsString($codeObj); |
| 167 | $this->assertNotEmpty($result); |
| 168 | $this->assertStringContainsString('2026', $result); |
| 169 | } |
| 170 | |
| 171 | // ── getLabelNamePerTicket ────────────────────────────────────── |
| 172 | |
| 173 | public function test_getLabelNamePerTicket_default(): void { |
| 174 | $product = $this->createTicketProductWithDates([]); |
| 175 | |
| 176 | $label = $this->main->getTicketHandler()->getLabelNamePerTicket($product->get_id()); |
| 177 | $this->assertStringContainsString('#{count}', $label); |
| 178 | } |
| 179 | |
| 180 | public function test_getLabelNamePerTicket_custom(): void { |
| 181 | $product = $this->createTicketProductWithDates([ |
| 182 | 'saso_eventtickets_request_name_per_ticket_label' => 'Attendee name #{count}:', |
| 183 | ]); |
| 184 | |
| 185 | $label = $this->main->getTicketHandler()->getLabelNamePerTicket($product->get_id()); |
| 186 | $this->assertEquals('Attendee name #{count}:', $label); |
| 187 | } |
| 188 | |
| 189 | // ── getLabelValuePerTicket ───────────────────────────────────── |
| 190 | |
| 191 | public function test_getLabelValuePerTicket_default(): void { |
| 192 | $product = $this->createTicketProductWithDates([]); |
| 193 | |
| 194 | $label = $this->main->getTicketHandler()->getLabelValuePerTicket($product->get_id()); |
| 195 | $this->assertStringContainsString('#{count}', $label); |
| 196 | } |
| 197 | |
| 198 | // ── getLabelDaychooserPerTicket ──────────────────────────────── |
| 199 | |
| 200 | public function test_getLabelDaychooserPerTicket_default(): void { |
| 201 | $product = $this->createTicketProductWithDates([]); |
| 202 | |
| 203 | $label = $this->main->getTicketHandler()->getLabelDaychooserPerTicket($product->get_id()); |
| 204 | $this->assertStringContainsString('#{count}', $label); |
| 205 | } |
| 206 | |
| 207 | public function test_getLabelDaychooserPerTicket_custom(): void { |
| 208 | $product = $this->createTicketProductWithDates([ |
| 209 | 'saso_eventtickets_request_daychooser_per_ticket_label' => 'Select day #{count}:', |
| 210 | ]); |
| 211 | |
| 212 | $label = $this->main->getTicketHandler()->getLabelDaychooserPerTicket($product->get_id()); |
| 213 | $this->assertEquals('Select day #{count}:', $label); |
| 214 | } |
| 215 | |
| 216 | // ── getRedeemAmountText ─────────────────────────────────────── |
| 217 | |
| 218 | public function test_getRedeemAmountText_empty_when_max_is_1(): void { |
| 219 | $product = $this->createTicketProductWithDates([ |
| 220 | 'saso_eventtickets_ticket_max_redeem_amount' => 1, |
| 221 | ]); |
| 222 | |
| 223 | $listId = intval(get_post_meta($product->get_id(), 'saso_eventtickets_list', true)); |
| 224 | $metaObj = $this->main->getCore()->getMetaObject(); |
| 225 | $metaObj['wc_ticket']['is_ticket'] = 1; |
| 226 | $metaObj['woocommerce']['product_id'] = $product->get_id(); |
| 227 | $metaJson = $this->main->getCore()->json_encode_with_error_handling($metaObj); |
| 228 | |
| 229 | $code = 'RAT' . strtoupper(uniqid()); |
| 230 | $this->main->getDB()->insert('codes', [ |
| 231 | 'code' => $code, |
| 232 | 'code_display' => $code, |
| 233 | 'cvv' => '', |
| 234 | 'meta' => $metaJson, |
| 235 | 'aktiv' => 1, |
| 236 | 'redeemed' => 0, |
| 237 | 'list_id' => $listId, |
| 238 | 'order_id' => 0, |
| 239 | ]); |
| 240 | |
| 241 | $codeObj = $this->main->getCore()->retrieveCodeByCode($code); |
| 242 | $metaObj2 = $this->main->getCore()->encodeMetaValuesAndFillObject($codeObj['meta'], $codeObj); |
| 243 | $text = $this->main->getTicketHandler()->getRedeemAmountText($codeObj, $metaObj2); |
| 244 | // max_redeem_amount=1 means single redeem, no text needed |
| 245 | $this->assertEmpty($text); |
| 246 | } |
| 247 | |
| 248 | public function test_getRedeemAmountText_shows_amount_when_max_gt_1(): void { |
| 249 | $product = $this->createTicketProductWithDates([ |
| 250 | 'saso_eventtickets_ticket_max_redeem_amount' => 5, |
| 251 | ]); |
| 252 | |
| 253 | $listId = intval(get_post_meta($product->get_id(), 'saso_eventtickets_list', true)); |
| 254 | $metaObj = $this->main->getCore()->getMetaObject(); |
| 255 | $metaObj['wc_ticket']['is_ticket'] = 1; |
| 256 | $metaObj['woocommerce']['product_id'] = $product->get_id(); |
| 257 | $metaJson = $this->main->getCore()->json_encode_with_error_handling($metaObj); |
| 258 | |
| 259 | $code = 'RA5' . strtoupper(uniqid()); |
| 260 | $this->main->getDB()->insert('codes', [ |
| 261 | 'code' => $code, |
| 262 | 'code_display' => $code, |
| 263 | 'cvv' => '', |
| 264 | 'meta' => $metaJson, |
| 265 | 'aktiv' => 1, |
| 266 | 'redeemed' => 0, |
| 267 | 'list_id' => $listId, |
| 268 | 'order_id' => 0, |
| 269 | ]); |
| 270 | |
| 271 | $codeObj = $this->main->getCore()->retrieveCodeByCode($code); |
| 272 | $metaObj2 = $this->main->getCore()->encodeMetaValuesAndFillObject($codeObj['meta'], $codeObj); |
| 273 | $text = $this->main->getTicketHandler()->getRedeemAmountText($codeObj, $metaObj2); |
| 274 | $this->assertNotEmpty($text); |
| 275 | $this->assertStringContainsString('5', $text); |
| 276 | } |
| 277 | |
| 278 | // ── generateICSFile ─────────────────────────────────────────── |
| 279 | |
| 280 | public function test_generateICSFile_returns_valid_ics(): void { |
| 281 | $product = $this->createTicketProductWithDates([ |
| 282 | 'saso_eventtickets_ticket_start_date' => '2026-08-01', |
| 283 | 'saso_eventtickets_ticket_start_time' => '10:00:00', |
| 284 | 'saso_eventtickets_ticket_end_date' => '2026-08-01', |
| 285 | 'saso_eventtickets_ticket_end_time' => '18:00:00', |
| 286 | ]); |
| 287 | |
| 288 | $ticket = $this->main->getTicketHandler(); |
| 289 | $ics = $ticket->generateICSFile($product); |
| 290 | |
| 291 | $this->assertStringContainsString('BEGIN:VCALENDAR', $ics); |
| 292 | $this->assertStringContainsString('END:VCALENDAR', $ics); |
| 293 | $this->assertStringContainsString('BEGIN:VEVENT', $ics); |
| 294 | $this->assertStringContainsString('DTSTART:', $ics); |
| 295 | $this->assertStringContainsString('DTEND:', $ics); |
| 296 | $this->assertStringContainsString('SUMMARY:Display Test Product', $ics); |
| 297 | } |
| 298 | |
| 299 | public function test_generateICSFile_no_explicit_date_still_generates(): void { |
| 300 | // Without explicit dates, calcDateStringAllowedRedeemFrom may provide defaults |
| 301 | $product = $this->createTicketProductWithDates([]); |
| 302 | |
| 303 | $ticket = $this->main->getTicketHandler(); |
| 304 | try { |
| 305 | $ics = $ticket->generateICSFile($product); |
| 306 | // If it doesn't throw, it should still be valid ICS |
| 307 | $this->assertStringContainsString('BEGIN:VCALENDAR', $ics); |
| 308 | } catch (Exception $e) { |
| 309 | // Also acceptable: throws when no date available |
| 310 | $this->assertStringContainsString('No date available', $e->getMessage()); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | public function test_generateICSFile_only_start_time_uses_today(): void { |
| 315 | $product = $this->createTicketProductWithDates([ |
| 316 | 'saso_eventtickets_ticket_start_time' => '14:00:00', |
| 317 | ]); |
| 318 | |
| 319 | $ticket = $this->main->getTicketHandler(); |
| 320 | $ics = $ticket->generateICSFile($product); |
| 321 | |
| 322 | $this->assertStringContainsString('BEGIN:VCALENDAR', $ics); |
| 323 | $this->assertStringContainsString('DTSTART:', $ics); |
| 324 | } |
| 325 | |
| 326 | public function test_generateICSFile_with_location(): void { |
| 327 | $product = $this->createTicketProductWithDates([ |
| 328 | 'saso_eventtickets_ticket_start_date' => '2026-09-15', |
| 329 | 'saso_eventtickets_ticket_start_time' => '19:00:00', |
| 330 | 'saso_eventtickets_event_location' => 'Olympiastadion Berlin', |
| 331 | ]); |
| 332 | |
| 333 | $ticket = $this->main->getTicketHandler(); |
| 334 | $ics = $ticket->generateICSFile($product); |
| 335 | |
| 336 | $this->assertStringContainsString('LOCATION:', $ics); |
| 337 | $this->assertStringContainsString('Olympiastadion', $ics); |
| 338 | } |
| 339 | } |
| 340 |