Exemplo n.º 1
0
 /**
  * (non-PHPdoc)
  * @see ActiveSync/ActiveSync_TestCase::setUp()
  */
 public function setUp()
 {
     $this->_db = ConnectionManager::getDataSource('test');
     $this->_db->begin();
     $this->_deviceBackend = new Syncroton_Backend_Device($this->_db);
     $this->_folderBackend = new Syncroton_Backend_Folder($this->_db);
     require_once dirname(__FILE__) . DS . 'DeviceTest.php';
     $newDevice = DeviceTest::getTestDevice();
     $this->_device = $this->_deviceBackend->create($newDevice);
 }
Exemplo n.º 2
0
 /**
  * (non-PHPdoc)
  * @see Syncroton/Syncroton_TestCase::setUp()
  */
 public function setUp()
 {
     Syncroton_Registry::setDatabase(ConnectionManager::getDataSource('test'));
     Syncroton_Registry::getTransactionManager()->startTransaction(Syncroton_Registry::getDatabase());
     Syncroton_Registry::set('loggerBackend', new Syncroton_Log('lil_active_sync'));
     try {
         $device = Syncroton_Registry::getDeviceBackend()->getUserDevice('1234', 'iphone-abcd');
         Syncroton_Registry::getDeviceBackend()->delete($device);
     } catch (Syncroton_Exception_NotFound $e) {
         // do nothing => it's ok
     }
     require_once dirname(dirname(__FILE__)) . DS . 'Backend' . DS . 'DeviceTest.php';
     $this->_device = Syncroton_Registry::getDeviceBackend()->create(DeviceTest::getTestDevice());
     Syncroton_Registry::setContactsDataClass('Syncroton_Data_Contacts');
     Syncroton_Registry::setCalendarDataClass('Syncroton_Data_Calendar');
     Syncroton_Registry::setEmailDataClass('Syncroton_Data_Email');
     Syncroton_Registry::setTasksDataClass('Syncroton_Data_Tasks');
     Syncroton_Registry::setGALDataClass('Syncroton_Data_Contacts');
     // speed up tests
     Syncroton_Registry::set(Syncroton_Registry::PING_TIMEOUT, 1);
     Syncroton_Registry::set(Syncroton_Registry::QUIET_TIME, 1);
 }
Exemplo n.º 3
0
 /**
  * (non-PHPdoc)
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 public function setUp()
 {
     require_once dirname(dirname(__FILE__)) . DS . 'Backend' . DS . 'DeviceTest.php';
     $this->_testDevice = DeviceTest::getTestDevice(Syncroton_Model_Device::TYPE_ANDROID);
 }
Exemplo n.º 4
0
 /**
  * test get version BlackBerry 10
  */
 public function testGetVersionBlackBerry()
 {
     require_once dirname(dirname(__FILE__)) . DS . 'Backend' . DS . 'DeviceTest.php';
     $blackBerry = DeviceTest::getTestDevice(Syncroton_Model_Device::TYPE_BLACKBERRY);
     $this->assertEquals('10.2.0.1443', $blackBerry->getMajorVersion());
 }
Exemplo n.º 5
0
 public function testDeleteEntry()
 {
     try {
         $device = Syncroton_Registry::getDeviceBackend()->getUserDevice('1234', 'iphone-abcd');
         Syncroton_Registry::getDeviceBackend()->delete($device);
     } catch (Syncroton_Exception_NotFound $e) {
         // do nothing => it's ok
     }
     require_once dirname(dirname(__FILE__)) . DS . 'Backend' . DS . 'DeviceTest.php';
     $device = Syncroton_Registry::getDeviceBackend()->create(DeviceTest::getTestDevice(Syncroton_Model_Device::TYPE_IPHONE));
     $dataController = Syncroton_Data_Factory::factory(Syncroton_Data_Factory::CLASS_CONTACTS, $device, new DateTime(null, new DateTimeZone('UTC')));
     $entries = $dataController->getServerEntries('addressbookFolderId', null);
     $dataController->deleteEntry('addressbookFolderId', $entries[0], array());
     $newEntries = $dataController->getServerEntries('addressbookFolderId', null);
     $this->assertArrayNotHasKey($entries[0], $newEntries);
 }