Merge branch '2013.10' into 2014.11
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 28 Jan 2015 18:49:52 +0000 (19:49 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 28 Jan 2015 18:49:52 +0000 (19:49 +0100)
Conflicts:
tests/tine20/ActiveSync/AllTests.php
tests/tine20/ActiveSync/TestCase.php
tests/tine20/Addressbook/Frontend/ActiveSyncTest.php
tests/tine20/Calendar/Frontend/ActiveSyncTest.php
tests/tine20/Tasks/Frontend/ActiveSyncTest.php

Change-Id: I5543782187ccaa555f94cc1213f30e70096508bf

1  2 
tests/tine20/ActiveSync/AllTests.php
tests/tine20/ActiveSync/TestCase.php
tests/tine20/Addressbook/Frontend/ActiveSyncTest.php
tests/tine20/Calendar/Frontend/ActiveSyncTest.php
tests/tine20/Tasks/Frontend/ActiveSyncTest.php
tine20/Calendar/Controller/Event.php
tine20/Calendar/js/EventEditDialog.js
tine20/Tinebase/js/widgets/grid/GridPanel.js

@@@ -22,14 -17,15 +22,16 @@@ class ActiveSync_AllTest
      
      public static function suite ()
      {
 -        $suite = new PHPUnit_Framework_TestSuite('Tine 2.0 ActiveSync All Tests');
 +        $suite = new PHPUnit_Framework_TestSuite('All ActiveSync tests');
 +        
 +        $suite->addTest(ActiveSync_Command_AllTests::suite());
 +        $suite->addTest(ActiveSync_Controller_AllTests::suite());
 +        $suite->addTest(ActiveSync_Backend_AllTests::suite());
          
          $suite->addTestSuite('ActiveSync_TimezoneConverterTest');
 -        $suite->addTestSuite('ActiveSync_Command_AllTests');
 -        $suite->addTestSuite('ActiveSync_Controller_AllTests');
 -        $suite->addTestSuite('ActiveSync_Backend_AllTests');
          
+         $suite->addTestSuite('ActiveSync_Frontend_JsonTests');
+         
          return $suite;
      }
  }
@@@ -9,7 -9,7 +9,7 @@@
   */
  
  /**
-  * abstract test class for activesync frontend tests
 - * abstract test class for activesync controller tests
++ * abstract test class for activesync tests
   * 
   * @package     ActiveSync
   */
@@@ -80,198 -68,11 +68,11 @@@ abstract class ActiveSync_TestCase exte
          Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new Syncroton_Backend_Content(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
          Syncroton_Registry::set('loggerBackend',                         Tinebase_Core::getLogger());
          
 -        Syncroton_Registry::setContactsDataClass('ActiveSync_Controller_Contacts');
 -        Syncroton_Registry::setCalendarDataClass('ActiveSync_Controller_Calendar');
 -        Syncroton_Registry::setEmailDataClass('ActiveSync_Controller_Email');
 -        Syncroton_Registry::setTasksDataClass('ActiveSync_Controller_Tasks');
 +        Syncroton_Registry::setContactsDataClass('Addressbook_Frontend_ActiveSync');
 +        Syncroton_Registry::setCalendarDataClass('Calendar_Frontend_ActiveSync');
 +        Syncroton_Registry::setEmailDataClass('Felamimail_Frontend_ActiveSync');
 +        Syncroton_Registry::setTasksDataClass('Tasks_Frontend_ActiveSync');
      }
-     /**
-      *
-      * @return Syncroton_Model_Folder
-      */
-     public function testCreateFolder()
-     {
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_IPHONE), new Tinebase_DateTime(null, null, 'de_DE'));
-         
-         $syncrotonFolder = $controller->createFolder(new Syncroton_Model_Folder(array(
-             'parentId' => 0, 
-             'displayName' => 'TestFolder'
-         )));
-     
-         $this->assertTrue(!empty($syncrotonFolder->serverId));
-         
-         return $syncrotonFolder;
-     }
-     
-     /**
-      * 
-      * @return Syncroton_Model_Folder
-      */
-     public function testUpdateFolder()
-     {
-         $syncrotonFolder = $this->testCreateFolder();
-         $syncrotonFolder->displayName = 'RenamedTestFolder';
-     
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_IPHONE), new Tinebase_DateTime(null, null, 'de_DE'));
-     
-         $updatedSyncrotonFolder = $controller->updateFolder($syncrotonFolder);
-         
-         $allFolders = $controller->getAllFolders();
-         
-         $this->assertArrayHasKey($syncrotonFolder->serverId, $allFolders);
-         $this->assertEquals('RenamedTestFolder', $allFolders[$syncrotonFolder->serverId]->displayName);
-         
-         return $updatedSyncrotonFolder;
-     }
-     
-     /**
-      * @return Syncroton_Model_Folder
-      */
-     public function testUpdateFolderAndroid()
-     {
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_ANDROID), new Tinebase_DateTime(null, null, 'de_DE'));
-         
-         $syncrotonFolders = $controller->getAllFolders();
-     
-         #var_dump($syncrotonFolders); return;
-         
-         $this->setExpectedException('Syncroton_Exception_UnexpectedValue');
-         
-         $updatedSyncrotonFolder = $controller->updateFolder($syncrotonFolders[$this->_specialFolderName]);
-     }
-     
-     /**
-      * test if changed folders got returned
-      */
-     public function testGetChangedFolders()
-     {
-         $syncrotonFolder = $this->testUpdateFolder();
-         
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_IPHONE), new Tinebase_DateTime(null, null, 'de_DE'));
-         
-         $changedFolders = $controller->getChangedFolders(Tinebase_DateTime::now()->subMinute(1), Tinebase_DateTime::now());
-         
-         //var_dump($changedFolders);
-         
-         $this->assertGreaterThanOrEqual(1, count($changedFolders));
-         $this->assertArrayHasKey($syncrotonFolder->serverId, $changedFolders);
-     }
-     
-     public function testDeleteFolder()
-     {
-         $this->markTestIncomplete('not yet implemented in controller');
-         
-         $syncrotonFolder = $this->testCreateFolder();
-     
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_IPHONE), new Tinebase_DateTime(null, null, 'de_DE'));
-     
-         $controller->deleteFolder($syncrotonFolder);
-     }
-     
-     public function testGetAllFolders()
-     {
-         $syncrotonFolder = $this->testCreateFolder();
-     
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_IPHONE), new Tinebase_DateTime(null, null, 'de_DE'));
-     
-         $allSyncrotonFolders = $controller->getAllFolders();
-         
-         $this->assertArrayHasKey($syncrotonFolder->serverId, $allSyncrotonFolders);
-         $this->assertArrayNotHasKey($this->_specialFolderName, $allSyncrotonFolders);
-         $this->assertTrue($allSyncrotonFolders[$syncrotonFolder->serverId] instanceof Syncroton_Model_Folder);
-         $this->assertEquals($syncrotonFolder->serverId, $allSyncrotonFolders[$syncrotonFolder->serverId]->serverId, 'serverId mismatch');
-         $this->assertEquals($syncrotonFolder->parentId, $allSyncrotonFolders[$syncrotonFolder->serverId]->parentId, 'parentId mismatch');
-         $this->assertEquals($syncrotonFolder->displayName, $allSyncrotonFolders[$syncrotonFolder->serverId]->displayName);
-         $this->assertTrue(!empty($allSyncrotonFolders[$syncrotonFolder->serverId]->type));
-     }
-     
-     public function testGetAllFoldersPalm()
-     {
-         $syncrotonFolder = $this->testCreateFolder();
-     
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_WEBOS), new Tinebase_DateTime(null, null, 'de_DE'));
-     
-         $allSyncrotonFolders = $controller->getAllFolders();
-         
-         $this->assertArrayHasKey($this->_specialFolderName, $allSyncrotonFolders, "key {$this->_specialFolderName} not found in " . print_r($allSyncrotonFolders, true));
-     }
-     
-     /**
-      * testDeleteEntry
-      */
-     public function testDeleteEntry()
-     {
-         $syncrotonFolder = $this->testCreateFolder();
-         
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_IPHONE), new Tinebase_DateTime(null, null, 'de_DE'));
-         
-         list($serverId, $syncrotonContact) = $this->testCreateEntry($syncrotonFolder);
-         
-         $controller->deleteEntry($syncrotonFolder->serverId, $serverId, null);
-         
-         try {
-             $syncrotonContact = $controller->getEntry(new Syncroton_Model_SyncCollection(array('collectionId' => $syncrotonFolder->serverId)), $serverId);
-             $this->fail('should have thrown Syncroton_Exception_NotFound: '
-                 . var_export($syncrotonContact, TRUE)
-                 . ' tine contact: ' . print_r(Addressbook_Controller_Contact::getInstance()->get($serverId)->toArray(), TRUE));
-         } catch (Syncroton_Exception_NotFound $senf) {
-             $this->assertEquals('Syncroton_Exception_NotFound', get_class($senf));
-         }
-     }
-     
-     public function testGetInvalidEntry()
-     {
-         $syncrotonFolder = $this->testCreateFolder();
-     
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_IPHONE), new Tinebase_DateTime(null, null, 'de_DE'));
-     
-         $this->setExpectedException('Syncroton_Exception_NotFound');
-     
-         $syncrotonContact = $controller->getEntry(new Syncroton_Model_SyncCollection(array('collectionId' => $syncrotonFolder->serverId)), 'jdszfegd63gfrk');
-     }
-     
-     /**
-      * test get changed entries
-      */
-     public function testGetChangedEntries()
-     {
-         $syncrotonFolder = $this->testCreateFolder();
-     
-         list($serverId, $syncrotonContact) = $this->testUpdateEntry($syncrotonFolder);
-     
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_IPHONE), new Tinebase_DateTime(null, null, 'de_DE'));
-     
-         $changedEntries = $controller->getChangedEntries($syncrotonFolder->serverId, new DateTime('2000-01-01'));
-         
-         $this->assertContains($serverId, $changedEntries, 'did not get changed record id in ' . print_r($changedEntries, TRUE));
-     }
-     
-     /**
-      * test get changed entries for android
-      */
-     public function testGetChangedEntriesAndroid()
-     {
-         $syncrotonFolder = $this->testCreateFolder();
-     
-         list($serverId, $syncrotonContact) = $this->testUpdateEntry($syncrotonFolder);
-     
-         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_ANDROID), Tinebase_DateTime::now());
-     
-         $changedEntries = $controller->getChangedEntries($this->_specialFolderName, new Tinebase_DateTime('2000-01-01'));
-     
-         $this->assertContains($serverId, $changedEntries, 'did not get changed record id in ' . print_r($changedEntries, TRUE));
-     }
-     
-     /**
-      * test convert from XML to Tine 2.0 model
-      */
-     abstract public function testCreateEntry($syncrotonFolder = null);
-     
-     /**
-      * test xml generation for sync to client
-      */
-     abstract public function testUpdateEntry($syncrotonFolder = null);
      
      /**
       * create container with sync grant
@@@ -9,11 -9,11 +9,11 @@@
   */
  
  /**
 - * Test class for Calendar_Controller_Event
 + * Test class for Addressbook_Frontend_ActiveSync
   * 
 - * @package     Calendar
 + * @package     Addressbook
   */
- class Addressbook_Frontend_ActiveSyncTest extends ActiveSync_TestCase
 -class ActiveSync_Controller_ContactsTests extends ActiveSync_Controller_ControllerTest
++class Addressbook_Frontend_ActiveSyncTest extends ActiveSync_Controller_ControllerTest
  {
      /**
       * name of the application
@@@ -9,11 -9,11 +9,11 @@@
   */
  
  /**
 - * Test class for Calendar_Controller_Event
 + * Test class for Calendar_Frontend_ActiveSync
   * 
 - * @package     ActiveSync
 + * @package     Calendar
   */
- class Calendar_Frontend_ActiveSyncTest extends ActiveSync_TestCase
 -class ActiveSync_Controller_CalendarTests extends ActiveSync_Controller_ControllerTest
++class Calendar_Frontend_ActiveSyncTest extends ActiveSync_Controller_ControllerTest
  {
      /**
       * name of the application
@@@ -9,11 -9,11 +9,11 @@@
   */
  
  /**
 - * Test class for Tasks_Controller_Task
 + * Test class for Tasks_Frontend_ActiveSync
   * 
 - * @package     ActiveSync
 + * @package     Tasks
   */
- class Tasks_Frontend_ActiveSyncTest extends ActiveSync_TestCase
 -class ActiveSync_Controller_TasksTests extends ActiveSync_Controller_ControllerTest
++class Tasks_Frontend_ActiveSyncTest extends ActiveSync_Controller_ControllerTest
  {
      /**
       * name of the application
Simple merge
Simple merge