#!perl use Cassandane::Tiny; sub test_recurring_allday_floating :min_version_3_9 :needs_component_jmap { my ($self) = @_; my $CalDAV = $self->{caldav}; my $jmap = $self->{jmap}; my $UTC = <NewCalendar({name => 'foo', timeZone => $UTC}); $self->assert_not_null($CalendarId); my $now = DateTime->today(); $now->set_time_zone('Etc/UTC'); # define the event to start next week my $startdt = $now->clone(); $startdt->add(days => 7); my $start = $startdt->strftime('%Y%m%d'); # set the trigger to notify us 5 hours before the event my $trigger="-PT5H"; my $uuid = "574E2CD0-2D2A-4554-8B63-C7504481D3A9"; my $href = "$CalendarId/$uuid.ics"; my $card = <Request('PUT', $href, $card, 'Content-Type' => 'text/calendar'); # clean notification cache $self->{instance}->getnotify(); $now->subtract(hours => 5); $self->{instance}->run_command({ cyrus => 1 }, 'calalarmd', '-t' => $now->epoch() + 60 ); $self->assert_alarms(); $now->add(days => 7); $self->{instance}->run_command({ cyrus => 1 }, 'calalarmd', '-t' => $now->epoch() + 60); $self->assert_alarms({summary => 'Simple', start => $start}); $now->add(days => 7); $startdt->add(days => 7); $start = $startdt->strftime('%Y%m%d'); $self->{instance}->run_command({ cyrus => 1 }, 'calalarmd', '-t' => $now->epoch() + 60); $self->assert_alarms({summary => 'Simple', start => $start}); # Change floating time zone on the calendar 2 hours to the east my $xml = < Etc/GMT-2 EOF my $res = $CalDAV->Request('PROPPATCH', "/dav/calendars/user/cassandane/". $CalendarId, $xml, 'Content-Type' => 'text/xml'); $now->add(days => 7); $startdt->add(days => 7); $start = $startdt->strftime('%Y%m%d'); # Need to trigger 2 hours earlier $self->{instance}->run_command({ cyrus => 1 }, 'calalarmd', '-t' => $now->epoch() - 7200 + 60); $self->assert_alarms({summary => 'Simple', start => $start}); # Change floating time zone on the calendar 2 more hours to the east $res = $jmap->CallMethods([ ['Calendar/set', {update => {$CalendarId => { timeZone => "Etc/GMT-4" }}}, "R1"] ]); $self->assert_not_null($res); $self->assert_not_null($res->[0][1]{updated}); $now->add(days => 7); $startdt->add(days => 7); $start = $startdt->strftime('%Y%m%d'); # Need to trigger 4 hours earlier $self->{instance}->run_command({ cyrus => 1 }, 'calalarmd', '-t' => $now->epoch() - 14400 + 60); $self->assert_alarms({summary => 'Simple', start => $start}); # Change floating time zone on the calendar back to original $xml = < $UTC EOF $res = $CalDAV->Request('PROPPATCH', "/dav/calendars/user/cassandane/". $CalendarId, $xml, 'Content-Type' => 'text/xml'); $now->add(days => 7); $startdt->add(days => 7); $start = $startdt->strftime('%Y%m%d'); $self->{instance}->run_command({ cyrus => 1 }, 'calalarmd', '-t' => $now->epoch() + 60); $self->assert_alarms({summary => 'Simple', start => $start}); }