MDL-76333 calendar: add test for calendar export

This commit is contained in:
Marina Glancy
2022-11-16 16:51:19 +01:00
parent 47d3e4217b
commit 55b9fa4b32
2 changed files with 27 additions and 8 deletions
+10 -8
View File
@@ -257,13 +257,15 @@ if(empty($serialized)) {
$filename = 'icalexport.ics';
header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0');
header('Expires: '. gmdate('D, d M Y H:i:s', 0) .'GMT');
header('Pragma: no-cache');
header('Accept-Ranges: none'); // Comment out if PDFs do not work...
header('Content-disposition: attachment; filename='.$filename);
header('Content-length: '.strlen($serialized));
header('Content-type: text/calendar; charset=utf-8');
if (!defined('BEHAT_SITE_RUNNING')) {
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0');
header('Expires: ' . gmdate('D, d M Y H:i:s', 0) . 'GMT');
header('Pragma: no-cache');
header('Accept-Ranges: none'); // Comment out if PDFs do not work...
header('Content-disposition: attachment; filename=' . $filename);
header('Content-length: ' . strlen($serialized));
header('Content-type: text/calendar; charset=utf-8');
}
echo $serialized;
+17
View File
@@ -30,6 +30,23 @@ Feature: Export calendar events
And I should see "Events related to groups"
And I should see "My personal events"
@javascript
Scenario: Export calendar in ics format
And I follow "Full calendar"
And I press "New event"
And I set the following fields to these values:
| Event title | My event |
| id_timestart_hour | 13 |
| id_timestart_minute | 00 |
And I press "Save"
When I click on "Import or export calendars" "link"
And I click on "Export calendar" "button"
And I set the field "All events" to "1"
And I set the field "This week" to "1"
And I press "Export"
And I should see "SUMMARY:My event"
And I should see "##today##DTSTART:%Y%m%dT050000Z##"
Scenario: Generating calendar URL for all events
Given I follow "Full calendar"
And I click on "Import or export calendars" "link"