@@ -23,6 +23,8 @@ protected function setUp(): void
2323 'start_time ' => '11:00 ' ,
2424 'end_time ' => '12:00 ' ,
2525 'location ' => 'The Location ' ,
26+ 'description ' => 'The description ' ,
27+ 'link ' => 'https://transformstudios.com '
2628 ])->save ();
2729 }
2830
@@ -38,6 +40,8 @@ public function can_create_single_day_event_ics_file()
3840
3941 $ this ->assertStringContainsString ('DTSTART: ' .now ()->setTimeFromTimeString ('11:00 ' )->format ('Ymd\THis ' ), $ response ->streamedContent ());
4042 $ this ->assertStringContainsString ('LOCATION:The Location ' , $ response ->streamedContent ());
43+ $ this ->assertStringContainsString ('DESCRIPTION:The description ' , $ response ->streamedContent ());
44+ $ this ->assertStringContainsString ('URL:https://transformstudios.com ' , $ response ->streamedContent ());
4145 }
4246
4347 #[Test]
@@ -55,6 +59,9 @@ public function can_create_single_day_recurring_event_ics_file()
5559 'start_time ' => '11:00 ' ,
5660 'end_time ' => '12:00 ' ,
5761 'recurrence ' => 'weekly ' ,
62+ 'location ' => 'The Location ' ,
63+ 'description ' => 'The description ' ,
64+ 'link ' => 'https://transformstudios.com '
5865 ])->save ();
5966
6067 $ response = $ this ->get (route ('statamic.events.ics.show ' , [
@@ -63,25 +70,95 @@ public function can_create_single_day_recurring_event_ics_file()
6370 ]))->assertDownload ('recurring-event.ics ' );
6471
6572 $ this ->assertStringContainsString ('DTSTART: ' .now ()->setTimeFromTimeString ('11:00 ' )->format ('Ymd\THis ' ), $ response ->streamedContent ());
73+ $ this ->assertStringContainsString ('LOCATION:The Location ' , $ response ->streamedContent ());
74+ $ this ->assertStringContainsString ('DESCRIPTION:The description ' , $ response ->streamedContent ());
75+ $ this ->assertStringContainsString ('URL:https://transformstudios.com ' , $ response ->streamedContent ());
6676
6777 $ this ->get (route ('statamic.events.ics.show ' , [
6878 'date ' => now ()->addDay ()->toDateString (),
6979 'event ' => 'the-recurring-id ' ,
7080 ]))->assertStatus (404 );
7181 }
7282
83+ #[Test]
84+ public function can_create_ics_with_single_date_recurrence ()
85+ {
86+ Carbon::setTestNow (now ()->addDay ()->setTimeFromTimeString ('10:00 ' ));
87+
88+ Entry::make ()
89+ ->collection ('events ' )
90+ ->slug ('recurring-event ' )
91+ ->id ('the-recurring-id ' )
92+ ->data ([
93+ 'title ' => 'Recurring Event ' ,
94+ 'start_date ' => Carbon::now ()->toDateString (),
95+ 'start_time ' => '11:00 ' ,
96+ 'end_time ' => '12:00 ' ,
97+ 'recurrence ' => 'weekly ' ,
98+ 'location ' => 'The Location ' ,
99+ 'description ' => 'The description ' ,
100+ 'link ' => 'https://transformstudios.com '
101+ ])->save ();
102+
103+ $ response = $ this ->get (route ('statamic.events.ics.show ' , [
104+ 'date ' => now ()->toDateString (),
105+ 'event ' => 'the-recurring-id ' ,
106+ ]))->assertDownload ('recurring-event.ics ' );
107+
108+
109+ $ this ->assertStringContainsString ('DTSTART: ' .now ()->setTimeFromTimeString ('11:00 ' )->format ('Ymd\THis ' ), $ response ->streamedContent ());
110+ $ this ->assertStringContainsString ('LOCATION:The Location ' , $ response ->streamedContent ());
111+ $ this ->assertStringContainsString ('DESCRIPTION:The description ' , $ response ->streamedContent ());
112+ $ this ->assertStringContainsString ('URL:https://transformstudios.com ' , $ response ->streamedContent ());
113+
114+ }
115+
116+ #[Test]
117+ public function can_create_ics_with_recurrence ()
118+ {
119+ Carbon::setTestNow (now ()->addDay ()->setTimeFromTimeString ('10:00 ' ));
120+
121+ Entry::make ()
122+ ->collection ('events ' )
123+ ->slug ('recurring-event ' )
124+ ->id ('the-recurring-id ' )
125+ ->data ([
126+ 'title ' => 'Recurring Event ' ,
127+ 'start_date ' => Carbon::now ()->toDateString (),
128+ 'start_time ' => '11:00 ' ,
129+ 'end_time ' => '12:00 ' ,
130+ 'recurrence ' => 'weekly ' ,
131+ 'location ' => 'The Location ' ,
132+ 'description ' => 'The description ' ,
133+ 'link ' => 'https://transformstudios.com '
134+ ])->save ();
135+
136+ $ response = $ this ->get (route ('statamic.events.ics.show ' , [
137+ 'event ' => 'the-recurring-id ' ,
138+ ]))->assertDownload ('recurring-event.ics ' );
139+
140+ $ this ->assertStringContainsString ('DTSTART: ' .now ()->setTimeFromTimeString ('11:00 ' )->format ('Ymd\THis ' ), $ response ->streamedContent ());
141+ $ this ->assertStringContainsString ('LOCATION:The Location ' , $ response ->streamedContent ());
142+ $ this ->assertStringContainsString ('DESCRIPTION:The description ' , $ response ->streamedContent ());
143+ $ this ->assertStringContainsString ('URL:https://transformstudios.com ' , $ response ->streamedContent ());
144+
145+ }
146+
73147 #[Test]
74148 public function can_create_single_day_multiday_event_ics_file ()
75149 {
76150 Carbon::setTestNow (now ());
77151
78- $ entry = Entry::make ()
152+ Entry::make ()
79153 ->slug ('multi-day-event ' )
80154 ->collection ('events ' )
81155 ->id ('the-multi-day-event ' )
82156 ->data ([
83157 'title ' => 'Multi-day Event ' ,
84158 'multi_day ' => true ,
159+ 'location ' => 'The Location ' ,
160+ 'description ' => 'The description ' ,
161+ 'link ' => 'https://transformstudios.com ' ,
85162 'days ' => [
86163 [
87164 'date ' => now ()->toDateString (),
@@ -112,6 +189,10 @@ public function can_create_single_day_multiday_event_ics_file()
112189 ]))->assertDownload ('multi-day-event.ics ' );
113190
114191 $ this ->assertStringContainsString ('DTSTART: ' .now ()->addDay ()->setTimeFromTimeString ('11:00 ' )->format ('Ymd\THis ' ), $ response ->streamedContent ());
192+ $ this ->assertStringContainsString ('LOCATION:The Location ' , $ response ->streamedContent ());
193+ $ this ->assertStringContainsString ('DESCRIPTION:The description ' , $ response ->streamedContent ());
194+ $ this ->assertStringContainsString ('URL:https://transformstudios.com ' , $ response ->streamedContent ());
195+
115196 }
116197
117198 #[Test]
0 commit comments