0011986: Default Calender in Preferences reset to personal one after logout/login
authorCornelius Weiß <c.weiss@metaways.de>
Fri, 30 Dec 2016 09:42:02 +0000 (10:42 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 30 Dec 2016 10:33:36 +0000 (11:33 +0100)
* forgot to commit test

Change-Id: I9b9f4db07f57495d4b39e8bda6e89107f6f351ce
Reviewed-on: http://gerrit.tine20.com/customers/4030
Tested-by: Philipp Schüle <p.schuele@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Calendar/JsonTests.php

index 7baf9a0..cbbca9f 100644 (file)
@@ -46,8 +46,31 @@ class Calendar_JsonTests extends Calendar_TestCase
         $registryData = $this->_uit->getRegistryData();
         
         $this->assertTrue(is_array($registryData['defaultContainer']['account_grants']));
+        $this->assertTrue(is_array($registryData['defaultContainer']['ownerContact']));
     }
-    
+
+    /**
+     * test shared calendar as default
+     * @see 0011986: Default Calender in Preferences restet to personal one after logout/login
+     */
+    public function testGetRegistryDataWithSharedDefault()
+    {
+        $fe = new Tinebase_Frontend_Json_Container();
+        $container = $fe->addContainer('Calendar', 'testdeletecontacts', Tinebase_Model_Container::TYPE_SHARED, '');
+
+        Tinebase_Core::set(Tinebase_Core::PREFERENCES, array());
+        Tinebase_Core::getPreference('Calendar')
+            ->setValue(Calendar_Preference::DEFAULTCALENDAR, $container['id']);
+
+        $registryData = $this->_uit->getRegistryData();
+
+        $this->assertTrue(is_array($registryData['defaultContainer']['account_grants']));
+        $this->assertFalse(isset($registryData['defaultContainer']['ownerContact']));
+
+        Tinebase_Core::getPreference('Calendar')
+            ->deleteUserPref(Calendar_Preference::DEFAULTCALENDAR);
+    }
+
     /**
      * testCreateEvent
      *