0011050: VEVENT converter: fix timezone handling for all day events
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 21 May 2015 10:42:14 +0000 (12:42 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 27 May 2015 15:39:04 +0000 (17:39 +0200)
* adds test for TZ handling with Asia/Tehran

https://forge.tine20.org/view.php?id=11050

Change-Id: Idfac8bf485a7892e47d981ca141f830de1da2d1f
Reviewed-on: http://gerrit.tine20.com/customers/1943
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Calendar/Convert/Event/VCalendar/GenericTest.php
tests/tine20/Calendar/Import/files/lightning_TehranTZ.ics [new file with mode: 0644]

index 77e80bb..5f2ccdc 100644 (file)
@@ -4,7 +4,7 @@
  * 
  * @package     Calendar
  * @license     http://www.gnu.org/licenses/agpl.html
- * @copyright   Copyright (c) 2011-2014 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2011-2015 Metaways Infosystems GmbH (http://www.metaways.de)
  * @author      Lars Kneschke <l.kneschke@metaways.de>
  */
 
@@ -163,7 +163,19 @@ class Calendar_Convert_Event_VCalendar_GenericTest extends PHPUnit_Framework_Tes
         
         $this->assertEquals('Europe/Berlin', $event->originator_tz);
     }
-    
+
+    /**
+     * test converting vcard from lighting to Calendar_Model_Event (with exotic timezone: Asia/Tehran)
+     */
+    public function testConvertToTine20ModelWithTehranTZ()
+    {
+        $vcalendarStream = Calendar_Frontend_WebDAV_EventTest::getVCalendar(dirname(__FILE__) . '/../../../Import/files/lightning_TehranTZ.ics', 'r');
+        $this->_converter = Calendar_Convert_Event_VCalendar_Factory::factory(Calendar_Convert_Event_VCalendar_Factory::CLIENT_GENERIC);
+        $event = $this->_converter->toTine20Model($vcalendarStream);
+
+        $this->assertEquals('Asia/Tehran', $event->originator_tz);
+    }
+
     /**
      * test converting vcard from lighting to Calendar_Model_Event
      *
diff --git a/tests/tine20/Calendar/Import/files/lightning_TehranTZ.ics b/tests/tine20/Calendar/Import/files/lightning_TehranTZ.ics
new file mode 100644 (file)
index 0000000..3e590f9
--- /dev/null
@@ -0,0 +1,37 @@
+BEGIN:VCALENDAR
+PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
+VERSION:2.0
+BEGIN:VTIMEZONE
+TZID:Asia/Tehran
+TZURL:http://tzurl.org/zoneinfo-outlook/Asia/Tehran
+X-LIC-LOCATION:Asia/Tehran
+BEGIN:STANDARD
+TZOFFSETFROM:+0330
+TZOFFSETTO:+0330
+TZNAME:IRST
+DTSTART:19700101T000000
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+CREATED:20111007T160719Z
+LAST-MODIFIED:20111007T160719Z
+DTSTAMP:20111007T160719Z
+UID:9d28b78f-aa6d-44fc-92f6-5ab98d35d692
+SUMMARY:New Event
+ORGANIZER;CN=Lars Kneschke;RSVP=TRUE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:l.kneschke@metaway
+ s.de
+ATTENDEE;CN=Lars Kneschke;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIP
+ ANT:mailto:lars@kneschke.de
+CATEGORIES:Business
+DTSTART;TZID=Asia/Tehran:20111004T100000
+DTEND;TZIDAsia/Tehran:20111004T120000
+CLASS:PRIVATE
+LOCATION:Hamburg
+DESCRIPTION:This is a descpription\nwith a linebreak and a \; \, and :
+BEGIN:VALARM
+ACTION:DISPLAY
+TRIGGER;VALUE=DURATION:-PT1H15M
+DESCRIPTION:Default Mozilla Description
+END:VALARM
+END:VEVENT
+END:VCALENDAR
\ No newline at end of file