Merge branch '2013.03' into 2013.10
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 15 Nov 2013 14:11:24 +0000 (15:11 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 15 Nov 2013 14:11:24 +0000 (15:11 +0100)
Conflicts:
tests/tine20/Calendar/Convert/Event/VCalendar/MacOSXTest.php

1  2 
tests/tine20/Calendar/Convert/Event/VCalendar/MacOSXTest.php
tine20/Calendar/Convert/Event/VCalendar/Abstract.php
tine20/Calendar/Convert/Event/VCalendar/MacOSX.php

@@@ -34,30 -38,42 +34,46 @@@ class Calendar_Convert_Event_VCalendar_
          $suite  = new PHPUnit_Framework_TestSuite('Tine 2.0 Calendar WebDAV MacOSX Event Tests');
          PHPUnit_TextUI_TestRunner::run($suite);
      }
 -
 -    /**
 -     * Sets up the fixture.
 -     * This method is called before a test is executed.
 -     *
 -     * @access protected
 -     */
 -    protected function setUp()
 -    {
 -    }
 -
 +    
      /**
 -     * Tears down the fixture
 -     * This method is called after a test is executed.
 -     *
 -     * @access protected
 +     * testBackslashInDescription
 +     * 
 +     * @see 0009176: iCal adds another backslash to description field
       */
 -    protected function tearDown()
 +    public function testBackslashInDescription()
      {
 +        $event = new Calendar_Model_Event(array(
 +            'summary' => 'CalDAV test',
 +            'dtstart' => Tinebase_DateTime::now(),
 +            'dtend' => Tinebase_DateTime::now()->addHour(1),
 +            'description' => 'lalala \\\\',
 +            'originator_tz' => 'Europe/Berlin',
 +            'creation_time' => Tinebase_DateTime::now(),
 +            'uid' => Tinebase_Record_Abstract::generateUID(),
 +            'seq' => 1,
 +        ));
 +        
 +        $converter = Calendar_Convert_Event_VCalendar_Factory::factory(Calendar_Convert_Event_VCalendar_Factory::CLIENT_MACOSX);
 +        $vevent = $converter->fromTine20Model($event)->serialize();
 +        
 +        $convertedEvent = $converter->toTine20Model($vevent);
 +        
 +        $this->assertEquals($event->description, $convertedEvent->description);
      }
 -    
 -    
+     
+     /**
+      * test converting vcard from apple iCal to Calendar_Model_Event 
+      */
+     public function testConvertToTine20Model()
+     {
+         $vcalendarStream = fopen(dirname(__FILE__) . '/../../../Import/files/apple_caldendar_mavericks_organizer_only.ics', 'r');
+         
+         $converter = Calendar_Convert_Event_VCalendar_Factory::factory(Calendar_Convert_Event_VCalendar_Factory::CLIENT_MACOSX, '10.9');
+         
+         $event = $converter->toTine20Model($vcalendarStream);
+         
+         // assert testuser is not attendee
+         $this->assertEquals(1, $event->attendee->count(), 'there sould only be one attendee');
+         $this->assertNotEquals($event->organizer, $event->attendee[0]->user_id, 'organizer should not attend');
+     }
  }