/**
  * (non-PHPdoc)
  * @see ActiveSync/ActiveSync_TestCase::setUp()
  */
 protected function setUp()
 {
     parent::setUp();
     Syncroton_Registry::setDatabase(Tinebase_Core::getDb());
     Syncroton_Registry::setTransactionManager(Tinebase_TransactionManager::getInstance());
     Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new Syncroton_Backend_Device(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new Syncroton_Backend_Folder(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new Syncroton_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new Syncroton_Backend_Content(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new Syncroton_Backend_Policy(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     Syncroton_Registry::set('loggerBackend', Tinebase_Core::getLogger());
     Syncroton_Registry::setContactsDataClass('Addressbook_Frontend_ActiveSync');
     Syncroton_Registry::setCalendarDataClass('Calendar_Frontend_ActiveSync');
     Syncroton_Registry::setEmailDataClass('Felamimail_Frontend_ActiveSync');
     Syncroton_Registry::setTasksDataClass('Tasks_Frontend_ActiveSync');
     $this->_device = Syncroton_Registry::getDeviceBackend()->create(ActiveSync_TestCase::getTestDevice());
 }
コード例 #2
0
 /**
  * (non-PHPdoc)
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     parent::setUp();
     $this->_testUser = Tinebase_Core::getUser();
     $this->_specialFolderName = strtolower($this->_applicationName) . '-root';
     $this->objects['container'] = array();
     $this->objects['devices'] = array();
     $this->objects['tasks'] = array();
     $this->objects['events'] = array();
     Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new Syncroton_Backend_Device(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new Syncroton_Backend_Folder(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new Syncroton_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     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('Addressbook_Frontend_ActiveSync');
     Syncroton_Registry::setCalendarDataClass('Calendar_Frontend_ActiveSync');
     Syncroton_Registry::setEmailDataClass('Felamimail_Frontend_ActiveSync');
     Syncroton_Registry::setTasksDataClass('Tasks_Frontend_ActiveSync');
 }
コード例 #3
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);
 }
 /**
  * set up test environment
  * 
  * @todo move setup to abstract test case
  */
 protected function setUp()
 {
     parent::setUp();
     $imapConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::IMAP, new Tinebase_Config_Struct())->toArray();
     if (empty($imapConfig) || !(isset($imapConfig['useSystemAccount']) || array_key_exists('useSystemAccount', $imapConfig)) || $imapConfig['useSystemAccount'] != true) {
         $this->markTestSkipped('IMAP backend not configured');
     }
     $this->_testUser = Tinebase_Core::getUser();
     $this->_emailTestClass = new Felamimail_Controller_MessageTest();
     $this->_emailTestClass->setup();
     $this->_createdMessages = new Tinebase_Record_RecordSet('Felamimail_Model_Message');
     $this->objects['devices'] = array();
     Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new Syncroton_Backend_Device(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new Syncroton_Backend_Folder(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new Syncroton_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     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::set(Syncroton_Registry::POLICYBACKEND, new Syncroton_Backend_Policy(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_'));
     Syncroton_Registry::setContactsDataClass('Addressbook_Frontend_ActiveSync');
     Syncroton_Registry::setCalendarDataClass('Calendar_Frontend_ActiveSync');
     Syncroton_Registry::setEmailDataClass('Felamimail_Frontend_ActiveSync');
     Syncroton_Registry::setTasksDataClass('Tasks_Frontend_ActiveSync');
 }
コード例 #5
0
if (!defined('WEBROOT_DIR')) {
    define('WEBROOT_DIR', basename(dirname(__FILE__)));
}
if (!defined('WWW_ROOT')) {
    define('WWW_ROOT', dirname(__FILE__) . DS);
}
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
    if (function_exists('ini_set')) {
        ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
    }
    if (!(include 'Cake' . DS . 'bootstrap.php')) {
        $failed = true;
    }
} else {
    if (!(include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
        $failed = true;
    }
}
if (!empty($failed)) {
    trigger_error("CakePHP core could not be found.  Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
}
App::uses('ConnectionManager', 'Model');
Syncroton_Registry::setDatabase(ConnectionManager::getDataSource('default'));
Syncroton_Registry::set('loggerBackend', new Syncroton_Log());
Syncroton_Registry::setContactsDataClass('Syncroton_Data_Contacts');
Syncroton_Registry::setCalendarDataClass('Syncroton_Data_Calendar');
Syncroton_Registry::setTasksDataClass('Syncroton_Data_Tasks');
Syncroton_Registry::setEmailDataClass('Syncroton_Data_Email');
Syncroton_Registry::setNotesDataClass('Syncroton_Data_Notes');
$server = new Syncroton_Server($_SERVER['PHP_AUTH_USER']);
$server->handle();
コード例 #6
0
 /**
  * init registry
  */
 protected function _initializeRegistry()
 {
     ActiveSync_Controller::initSyncrotonRegistry();
     $applications = is_object(Tinebase_Core::getUser()) ? Tinebase_Core::getUser()->getApplications() : new Tinebase_Record_RecordSet('Tinebase_Model_Application');
     if ($applications->find('name', 'Addressbook')) {
         Syncroton_Registry::setContactsDataClass('Addressbook_Frontend_ActiveSync');
         Syncroton_Registry::setGALDataClass('Addressbook_Frontend_ActiveSync');
     }
     if ($applications->find('name', 'Calendar')) {
         Syncroton_Registry::setCalendarDataClass('Calendar_Frontend_ActiveSync');
     }
     if ($applications->find('name', 'Felamimail')) {
         Syncroton_Registry::setEmailDataClass('Felamimail_Frontend_ActiveSync');
     }
     if ($applications->find('name', 'Tasks')) {
         Syncroton_Registry::setTasksDataClass('Tasks_Frontend_ActiveSync');
     }
     Syncroton_Registry::set(Syncroton_Registry::DEFAULT_POLICY, ActiveSync_Config::getInstance()->get(ActiveSync_Config::DEFAULT_POLICY));
 }