Merge branch '2013.10' into 2014.11
[tine20] / tests / tine20 / Calendar / Controller / RecurTest.php
index 14f783c..e6bea9a 100644 (file)
@@ -35,7 +35,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2012-06-01 18:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2011-05-31 17:30:00',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
         ));
         
         $this->setExpectedException('Tinebase_Exception_Record_Validation');
@@ -85,7 +85,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2011-04-20 15:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=3;WKST=SU;BYDAY=TU,TH',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         
@@ -98,7 +98,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $persistentEventException = $this->_controller->createRecurException($eventException);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -133,7 +133,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $firstInstanceException->location = $location;
     
         $result = $this->_controller->update($firstInstanceException, FALSE, Calendar_Model_Event::RANGE_THISANDFUTURE);
-        $this->assertEquals($result->location, $location);
+        $this->assertEquals($location, $result->location);
     }
 
     /**
@@ -169,14 +169,14 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
                 'dtend'         => '2012-02-22 15:30:00',
                 'originator_tz' => 'Europe/Berlin',
                 'rrule'         => 'FREQ=DAILY;COUNT=3',
-                'container_id'  => $this->_testCalendar->getId(),
+                'container_id'  => $this->_getTestCalendar()->getId(),
         ));
         
         $persistentEvent = $this->_controller->create($event);
         
         // create exception
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents[2]->dtstart->subHour(5);
@@ -185,7 +185,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         
         // load series
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents->sort('dtstart', 'ASC');
@@ -210,14 +210,14 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'is_all_day_event'  => true,
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         
         $persistentEvent = $this->_controller->create($event);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -228,7 +228,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $persistentEventException = $this->_controller->createRecurException($exception, TRUE);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -249,7 +249,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-03-31 17:30:00',
             'exdate'        => '2009-03-27 18:00:00,2009-03-29 17:00:00',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         $event->attendee = $this->_getAttendee();
@@ -292,7 +292,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2011-04-20 15:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=3;WKST=SU;BYDAY=TU,TH',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         $event->attendee = $this->_getAttendee();
@@ -305,7 +305,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $this->_controller->attenderStatusCreateRecurException(clone $persistentEvent, $attendee, $attendee->status_authkey);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -323,15 +323,15 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $event->dtstart = '2010-05-20 06:00:00';
         $event->dtend = '2010-05-20 06:15:00';
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $this->_controller->create($event);
 
         $event1 = $this->_getRecurEvent();
         $event1->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $this->setExpectedException('Calendar_Exception_AttendeeBusy');
@@ -347,15 +347,15 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $event->dtstart = '2010-05-20 06:00:00';
         $event->dtend = '2010-05-20 06:15:00';
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $this->_controller->create($event);
 
         $event1 = $this->_getRecurEvent();
         $event1->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $event1 = $this->_controller->create($event1);
@@ -377,8 +377,8 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $event = $this->_getRecurEvent();
         $event->rrule = "FREQ=MONTHLY;INTERVAL=1;BYDAY=3TH";
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $persistentRecurEvent = $this->_controller->create($event);
@@ -421,7 +421,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
                 'dtstart'       => '2012-03-13 09:00:00',
                 'dtend'         => '2012-03-13 10:00:00',
                 'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-                'container_id'  => $this->_testCalendar->getId(),
+                'container_id'  => $this->_getTestCalendar()->getId(),
                 'attendee'      => $this->_getAttendee(),
         ));
         
@@ -467,7 +467,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2011-04-21 12:00:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2011-04-28 21:59:59',
-            'container_id'  => $this->_testCalendar->getId()
+            'container_id'  => $this->_getTestCalendar()->getId()
         ));
         
         $persistentEvent = $this->_controller->create($event);
@@ -511,7 +511,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $newBaseEvent = $this->_controller->createRecurException($recurSet[3], FALSE, TRUE); // split at 25
         
         $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period', 'operator' => 'within', 'value' => array('from' => $from, 'until' => $until),
         ))));
         
@@ -606,7 +606,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtstart'       => '2012-02-03 09:00:00',
             'dtend'         => '2012-02-03 10:00:00',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             'attendee'      => $this->_getAttendee(),
         ));
         
@@ -644,7 +644,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2012-06-01 12:00:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId()
+            'container_id'  => $this->_getTestCalendar()->getId()
         ));
         
         $persistentEvent = $this->_controller->create($event);
@@ -677,7 +677,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtstart'       => '2012-02-03 09:00:00',
             'dtend'         => '2012-02-03 10:00:00',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             'attendee'      => $this->_getAttendee(),
         ));
         
@@ -693,7 +693,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $this->_controller->attenderStatusCreateRecurException($start, $sclever, $sclever->status_authkey, TRUE);
         
         $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )))->sort('dtstart', 'ASC');
         
         // assert two baseEvents
@@ -707,7 +707,63 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $this->assertFalse($events[1]->rrule_until instanceof Tinebase_DateTime, 'rrule_until of second baseEvent must not be set');
         $this->assertEquals(Calendar_Model_Attender::STATUS_ACCEPTED, Calendar_Model_Attender::getAttendee($events[1]->attendee, $event->attendee[1])->status, 'second baseEvent status is not touched');
     }
-    
+
+    public function testCreateRecurException()
+    {
+        $event = $this->_getEvent();
+        $event->rrule = 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-30 13:30:00';
+        $persistentEvent = $this->_controller->create($event);
+
+        $exception = clone $persistentEvent;
+        $exception->dtstart->addDay(3);
+        $exception->dtend->addDay(3);
+        $exception->summary = 'Abendbrot';
+        $exception->recurid = $exception->uid . '-' . $exception->dtstart->get(Tinebase_Record_Abstract::ISO8601LONG);
+        $persistentException = $this->_controller->createRecurException($exception);
+
+        $persistentEvent = $this->_controller->get($persistentEvent->getId());
+        $this->assertEquals(1, count($persistentEvent->exdate));
+
+        $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
+            array('field' => 'uid',     'operator' => 'equals', 'value' => $persistentEvent->uid),
+        )));
+        $this->assertEquals(2, count($events));
+
+        return $persistentException;
+    }
+
+    public function testGetRecurExceptions()
+    {
+        $persistentException = $this->testCreateRecurException();
+
+        $baseEvent = $this->_controller->getRecurBaseEvent($persistentException);
+
+        $exceptions = new Tinebase_Record_RecordSet('Calendar_Model_Event');
+        $nextOccurance = Calendar_Model_Rrule::computeNextOccurrence($baseEvent, $exceptions, $baseEvent->dtend);
+        $this->_controller->createRecurException($nextOccurance, TRUE);
+
+        $exceptions = $this->_controller->getRecurExceptions($persistentException, TRUE);
+        $dtstarts = $exceptions->dtstart;
+
+        $this->assertTrue(in_array($nextOccurance->dtstart, $dtstarts), 'deleted instance missing');
+        $this->assertTrue(in_array($persistentException->dtstart, $dtstarts), 'exception instance missing');
+    }
+
+    /**
+     * testUpdateEventWithRruleAndRecurId
+     *
+     * @see 0008696: do not allow both rrule and recurId in event
+     */
+    public function testUpdateEventWithRruleAndRecurId()
+    {
+        $persistentRecurEvent = $this->testCreateRecurException();
+        $persistentRecurEvent->rrule = 'FREQ=DAILY;INTERVAL=1';
+
+        $updatedEvent = $this->_controller->update($persistentRecurEvent);
+
+        $this->assertEquals(NULL, $updatedEvent->rrule);
+    }
+
    /**
     * @see {http://forge.tine20.org/mantisbt/view.php?id=5686}
     */
@@ -720,15 +776,49 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         
         $exceptions = new Tinebase_Record_RecordSet('Calendar_Model_Event');
         $recurSet = Calendar_Model_Rrule::computeRecurrenceSet($persistentEvent, $exceptions, $from, $until);
+
+        $pwulf = new Calendar_Model_Attender(array(
+            'user_type'   => Calendar_Model_Attender::USERTYPE_USER,
+            'user_id'     => $this->_getPersonasContacts('pwulf')->getId()
+        ));
+        $recurSet[5]->attendee->addRecord($pwulf);
+        
+        $updatedPersistentEvent = $this->_controller->createRecurException($recurSet[5], FALSE, TRUE);
+        
+        $this->assertEquals(3, count($updatedPersistentEvent->attendee));
+
+        $persistentPwulf = Calendar_Model_Attender::getAttendee($updatedPersistentEvent->attendee, $pwulf);
+        $this->assertNotNull($persistentPwulf->displaycontainer_id);
+    }
+    
+    /**
+     * Events don't show up in attendees personal calendar
+     */
+    public function testCreateRecurExceptionAllFollowingAttendeeAdd2()
+    {
+        $from = new Tinebase_DateTime('2014-04-01 00:00:00');
+        $until = new Tinebase_DateTime('2014-04-29 23:59:59');
+        
+        $persistentEvent = $this->_getDailyEvent(new Tinebase_DateTime('2014-04-03 09:00:00'));
+        
+        $exceptions = new Tinebase_Record_RecordSet('Calendar_Model_Event');
+        $recurSet = Calendar_Model_Rrule::computeRecurrenceSet($persistentEvent, $exceptions, $from, $until);
         
         $recurSet[5]->attendee->addRecord(new Calendar_Model_Attender(array(
-            'user_type'   => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'     => $this->_personasContacts['pwulf']->getId()
+                'user_type'   => Calendar_Model_Attender::USERTYPE_USER,
+                'user_id'     => $this->_getPersonasContacts('pwulf')->getId()
         )));
         
         $updatedPersistentEvent = $this->_controller->createRecurException($recurSet[5], FALSE, TRUE);
-        
         $this->assertEquals(3, count($updatedPersistentEvent->attendee));
+        
+        $filter = new Calendar_Model_EventFilter(array(
+                array('field' => 'container_id',             'operator' => 'equals', 'value' => $this->_personasDefaultCals['pwulf']->id),
+                array('field' => 'attender_status', 'operator' => 'not',    'value' => Calendar_Model_Attender::STATUS_DECLINED),
+        ));
+        
+        $events = $this->_controller->search($filter);
+        $this->assertEquals(1, count($events), 'event should be found, but is not');
     }
     
     /**
@@ -744,7 +834,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtstart'       => $dtstart->toString(),
             'dtend'         => $dtstart->addHour(1)->toString(),
             'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             'attendee'      => $this->_getAttendee(),
         ));
         return $this->_controller->create($event);
@@ -765,14 +855,14 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2012-02-21 15:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;COUNT=5',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
         ));
         
         $persistentEvent = $this->_controller->create($event);
         
         // create exception
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents[2]->dtstart->subHour(5);
@@ -781,7 +871,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         
         // load events
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents->sort('dtstart', 'ASC');
@@ -789,7 +879,26 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $this->assertEquals(2, count($weekviewEvents->filter('uid', $weekviewEvents[0]->uid)), 'shorten failed');
         $this->assertEquals(5, count($weekviewEvents), 'wrong total count');
     }
-    
+
+    public function testCreateRecurExceptionAllFollowingContainerMove()
+    {
+        $this->markTestSkipped('exdate container move not yet forbidden');
+        $exception = $this->testCreateRecurException();
+        $baseEvent = $this->_controller->getRecurBaseEvent($exception);
+
+        $exceptions = new Tinebase_Record_RecordSet('Calendar_Model_Event');
+        $from = $baseEvent->dtstart;
+        $until = $baseEvent->dtstart->getClone()->addDay(1);
+        $recurSet = Calendar_Model_Rrule::computeRecurrenceSet($baseEvent, $exceptions, $from, $until);
+
+        $recurSet->getFirstRecord()->container_id = $this->_getTestContainer('Calendar')->getId();
+        $newSeries = $this->_controller->createRecurException($recurSet->getFirstRecord(), false, true);
+        $newExceptions = $this->_controller->getRecurExceptions($newSeries);
+
+//        print_r($newSeries->toArray());
+//        print_r($newExceptions->toArray());
+    }
+
     /**
      * testMoveRecurException
      * 
@@ -818,7 +927,79 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $this->setExpectedException('Tinebase_Timemachine_Exception_ConcurrencyConflict');
         $updatedPersistentEvent = $this->_controller->createRecurException($updatedPersistentEvent);
     }
-    
+
+    public function testExdateContainerMoveCreateException()
+    {
+        $this->markTestSkipped('exdate container move not yet forbidden');
+        $event = $this->_getDailyEvent(new Tinebase_DateTime('2014-02-03 09:00:00'));
+
+        $exceptions = new Tinebase_Record_RecordSet('Calendar_Model_Event');
+        
+        $from = new Tinebase_DateTime('2014-02-01 00:00:00');
+        $until = new Tinebase_DateTime('2014-02-29 23:59:59');
+        
+        $recurSet = Calendar_Model_Rrule::computeRecurrenceSet($event, $exceptions, $from, $until);
+
+        $this->setExpectedException('Calendar_Exception_ExdateContainer');
+
+        $recurSet[2]->container_id = $this->_getTestContainer('Calendar')->getId();
+        $this->_controller->createRecurException($recurSet[2]);
+    }
+
+    public function testExdateContainerMoveUpdateException()
+    {
+        $this->markTestSkipped('exdate container move not yet forbidden');
+        $event = $this->_getDailyEvent(new Tinebase_DateTime('2014-02-03 09:00:00'));
+
+        $exceptions = new Tinebase_Record_RecordSet('Calendar_Model_Event');
+
+        $from = new Tinebase_DateTime('2014-02-01 00:00:00');
+        $until = new Tinebase_DateTime('2014-02-29 23:59:59');
+
+        $recurSet = Calendar_Model_Rrule::computeRecurrenceSet($event, $exceptions, $from, $until);
+
+        $recurSet[2]->summary = 'exdate';
+
+        $updatedPersistentEvent = $this->_controller->createRecurException($recurSet[2]);
+
+        $this->setExpectedException('Calendar_Exception_ExdateContainer');
+
+        $updatedPersistentEvent->container_id = $this->_getTestContainer('Calendar')->getId();
+        $this->_controller->update($updatedPersistentEvent);
+
+    }
+
+    /**
+     * test get free busy info with recurring event and dst
+     *
+     * @see 0009558: sometimes free/busy conflicts are not detected
+     */
+    public function testFreeBusyWithRecurSeriesAndRessourceInDST()
+    {
+        $event = $this->_getEvent();
+        $resource = Calendar_Controller_Resource::getInstance()->create($this->_getResource());
+        $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(array(
+            'user_id'   => $resource->getId(),
+            'user_type' => Calendar_Model_Attender::USERTYPE_RESOURCE,
+        )));
+        $event->dtstart = new Tinebase_DateTime('2013-10-14 10:30:00'); // this is UTC
+        $event->dtend = new Tinebase_DateTime('2013-10-14 11:45:00');
+        $event->rrule = 'FREQ=WEEKLY;INTERVAL=1;WKST=SU;BYDAY=MO';
+        $persistentEvent = Calendar_Controller_Event::getInstance()->create($event);
+
+        // check free busy in DST
+        $newEvent = $this->_getEvent();
+        $newEvent->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(array(
+            'user_id'   => $resource->getId(),
+            'user_type' => Calendar_Model_Attender::USERTYPE_RESOURCE,
+        )));
+        $newEvent->dtstart = new Tinebase_DateTime('2014-01-20 12:30:00');
+        $newEvent->dtend = new Tinebase_DateTime('2014-01-20 13:30:00');
+
+        $this->setExpectedException('Calendar_Exception_AttendeeBusy');
+        $savedEvent = Calendar_Controller_Event::getInstance()->create($newEvent, /* $checkBusyConflicts = */ true);
+    }
+
     /**
      * returns a simple recure event
      *
@@ -832,7 +1013,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'       => '2010-05-20 06:15:00',
             'description' => 'Breakfast',
             'rrule'       => 'FREQ=DAILY;INTERVAL=1',    
-            'container_id' => $this->_testCalendar->getId(),
+            'container_id' => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT    => true,
         ));
     }