@@ -370,10 +370,6 @@ public function test_get_venue_information(): void {
370
370
* Coverage for get_calendar_links method.
371
371
*
372
372
* @covers ::get_calendar_links
373
- * @covers Calendars::get_url
374
- * @covers Calendars::get_google_calendar_link
375
- * @covers Calendars::get_ical_file
376
- * @covers Calendars::get_yahoo_calendar_link
377
373
* @covers ::get_calendar_description
378
374
*
379
375
* @return void
@@ -407,8 +403,8 @@ public function test_get_calendar_links(): void {
407
403
408
404
$ event ->save_datetimes ( $ params );
409
405
410
- $ output = $ event ->get_calendar_links ();
411
406
407
+ /*
412
408
$expected_google_link = 'https://www.google.com/calendar/event?action=TEMPLATE&text=Unit%20Test%20Event&dates=20200511T150000Z%2F20200511T170000Z&details=' . rawurlencode( $description ) . '&location=Unit%20Test%20Venue%2C%20123%20Main%20Street%2C%20Montclair%2C%20NJ%2007042&sprop=name%3A';
413
409
$expected_yahoo_link = 'https://calendar.yahoo.com/?v=60&view=d&type=20&title=Unit%20Test%20Event&st=20200511T150000Z&dur=0200&desc=' . rawurlencode( $description ) . '&in_loc=Unit%20Test%20Venue%2C%20123%20Main%20Street%2C%20Montclair%2C%20NJ%2007042';
414
410
@@ -429,10 +425,66 @@ public function test_get_calendar_links(): void {
429
425
'name' => 'Yahoo Calendar',
430
426
'link' => $expected_yahoo_link,
431
427
),
428
+ ); */
429
+ $ output = $ event ->get_calendar_links ();
430
+ $ expects = array (
431
+ 'google ' => array (
432
+ 'name ' => 'Google Calendar ' ,
433
+ 'link ' => home_url ('/?gatherpress_event=unit-test-event&gatherpress_calendars=google-calendar ' ),
434
+ ),
435
+ 'ical ' => array (
436
+ 'name ' => 'iCal ' ,
437
+ 'download ' => home_url ('/?gatherpress_event=unit-test-event&gatherpress_calendars=ical ' ),
438
+ ),
439
+ 'outlook ' => array (
440
+ 'name ' => 'Outlook ' ,
441
+ 'download ' => home_url ('/?gatherpress_event=unit-test-event&gatherpress_calendars=outlook ' ),
442
+ ),
443
+ 'yahoo ' => array (
444
+ 'name ' => 'Yahoo Calendar ' ,
445
+ 'link ' => home_url ('/?gatherpress_event=unit-test-event&gatherpress_calendars=yahoo-calendar ' ),
446
+ ),
432
447
);
433
448
434
449
$ this ->assertSame ( $ expects , $ output );
435
450
451
+ // update_option( 'permalink_structure', '/%postname%/');
452
+ // flush_rewrite_rules();
453
+ // global $wp_rewrite;
454
+ // $wp_rewrite->set_permalink_structure('/%postname%/');
455
+ // $wp_rewrite->generate_rewrite_rules( $wp_rewrite->permalink_structure, EP_PERMALINK );
456
+ // Update permalink structure to '/%postname%/'.
457
+ update_option ( 'permalink_structure ' , '/%postname%/ ' );
458
+
459
+ // Reload the global rewrite rules object to ensure it reflects the changes.
460
+ global $ wp_rewrite ;
461
+ $ wp_rewrite ->init ();
462
+ flush_rewrite_rules ();
463
+
464
+ // Simulate a frontend request to trigger the new rewrite rules.
465
+ // $this->go_to( home_url( '/event/unit-test-event' ) );
466
+
467
+ $ output = $ event ->get_calendar_links ();
468
+ $ expects = array (
469
+ 'google ' => array (
470
+ 'name ' => 'Google Calendar ' ,
471
+ 'link ' => home_url ('/event/unit-test-event/google-calendar ' ),
472
+ ),
473
+ 'ical ' => array (
474
+ 'name ' => 'iCal ' ,
475
+ 'download ' => home_url ('/event/unit-test-event/ical ' ),
476
+ ),
477
+ 'outlook ' => array (
478
+ 'name ' => 'Outlook ' ,
479
+ 'download ' => home_url ('/event/unit-test-event/outlook ' ),
480
+ ),
481
+ 'yahoo ' => array (
482
+ 'name ' => 'Yahoo Calendar ' ,
483
+ 'link ' => home_url ('/event/unit-test-event/yahoo-calendar ' ),
484
+ ),
485
+ );
486
+ $ this ->assertSame ( $ expects , $ output );
487
+
436
488
Utility::set_and_get_hidden_property ( $ event , 'event ' , null );
437
489
438
490
$ this ->assertEmpty (
0 commit comments