Пример #1
0
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->objects['initialContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => Tinebase_Record_Abstract::generateUID(), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId())));
     $this->objects['sharedContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => Tinebase_Record_Abstract::generateUID(), 'type' => Tinebase_Model_Container::TYPE_SHARED, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId())));
     $_SERVER['REQUEST_URI'] = 'lars';
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $_SERVER['HTTP_USER_AGENT'] = 'FooBar User Agent';
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     Addressbook_Controller_Contact::getInstance()->setGeoDataForContacts(FALSE);
     $this->objects['initialContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => Tinebase_Record_Abstract::generateUID(), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Addressbook')->getId())));
 }
Пример #3
0
 /**
  * appends sql to given select statement
  *
  * @param  Zend_Db_Select                $_select
  * @param  Tinebase_Backend_Sql_Abstract $_backend
  * @throws Tinebase_Exception_NotFound
  */
 public function appendFilterSql($_select, $_backend)
 {
     // quote field identifier, set action and replace wildcards
     $field = $this->_getQuotedFieldName($_backend);
     $action = $this->_opSqlMap[$this->_operator];
     $value = $this->_replaceWildcards($this->_value);
     // check if group by is operator and return if this is the case
     if ($this->_operator == 'group') {
         $_select->group($this->_field);
     }
     if (in_array($this->_operator, array('in', 'notin')) && !is_array($value)) {
         $value = explode(' ', $value);
     }
     if (is_array($value) && empty($value)) {
         $_select->where('1=' . (substr($this->_operator, 0, 3) == 'not' ? '1/* empty query */' : '0/* impossible query */'));
         return;
     }
     $where = Tinebase_Core::getDb()->quoteInto($field . $action['sqlop'], $value);
     if (in_array($this->_operator, array('not', 'notin')) && $value !== '') {
         $where = "( {$where} OR {$field} IS NULL)";
     }
     if (in_array($this->_operator, array('equals', 'contains', 'startswith', 'endswith', 'in')) && $value === '') {
         $where = "( {$where} OR {$field} IS NULL)";
     }
     // finally append query to select object
     $_select->where($where);
 }
 /**
  * appends sql to given select statement
  *
  * @param Zend_Db_Select                $_select
  * @param Tinebase_Backend_Sql_Abstract $_backend
  */
 public function appendFilterSql($_select, $_backend)
 {
     // prepare value
     if ($this->_operator === 'equals' && empty($this->_value)) {
         // @see 0009362: allow to filter for empty datetimes
         $operator = 'isnull';
         $value = array($this->_value);
     } else {
         $operator = $this->_operator;
         $value = $this->_getDateValues($operator, $this->_value);
         if (!is_array($value)) {
             // NOTE: (array) null is an empty array
             $value = array($value);
         }
     }
     // quote field identifier
     $field = $this->_getQuotedFieldName($_backend);
     $db = Tinebase_Core::getDb();
     $dbCommand = Tinebase_Backend_Sql_Command::factory($db);
     // append query to select object
     foreach ((array) $this->_opSqlMap[$operator]['sqlop'] as $num => $operator) {
         if (isset($value[$num]) || array_key_exists($num, $value)) {
             if (get_parent_class($this) === 'Tinebase_Model_Filter_Date' || in_array($operator, array('isnull', 'notnull'))) {
                 $_select->where($field . $operator, $value[$num]);
             } else {
                 $_select->where($dbCommand->setDate($field) . $operator, new Zend_Db_Expr($dbCommand->setDateValue($value[$num])));
             }
         } else {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' No filter value found, skipping operator: ' . $operator);
             }
         }
     }
 }
 /**
  * constructor
  */
 public function __construct()
 {
     $this->_db = Tinebase_Core::getDb();
     $this->_dbCommand = Tinebase_Backend_Sql_Command::factory($this->_db);
     // temporary on the fly creation of table
     $this->_dbTable = new Tinebase_Db_Table(array('name' => SQL_TABLE_PREFIX . 'relations', 'primary' => 'id'));
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_contactController = Addressbook_Controller_Contact::getInstance();
     $this->_contractController = Sales_Controller_Contract::getInstance();
     $this->_json = new Sales_Frontend_Json();
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_backend = new Tasks_Frontend_Json();
     $this->_smtpConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::SMTP, new Tinebase_Config_Struct())->toArray();
     $this->_smtpTransport = Tinebase_Smtp::getDefaultTransport();
 }
 /**
  * set up tests
  */
 protected function setUp()
 {
     $this->_transactionId = Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     Addressbook_Controller_Contact::getInstance()->setGeoDataForContacts(false);
     $this->_personas = Zend_Registry::get('personas');
     $this->_originalTestUser = Tinebase_Core::getUser();
 }
Пример #9
0
 /**
  * appends sql to given select statement
  *
  * @param  Zend_Db_Select                $_select
  * @param  Tinebase_Backend_Sql_Abstract $_backend
  * @throws Tinebase_Exception_UnexpectedValue
  */
 public function appendFilterSql($_select, $_backend)
 {
     // don't take empty filter into account
     if (empty($this->_value) || !is_array($this->_value) || !isset($this->_value['cfId']) || empty($this->_value['cfId']) || !isset($this->_value['value'])) {
         return;
     } else {
         if ($this->_operator == 'in') {
             throw new Tinebase_Exception_UnexpectedValue('Operator "in" not supported.');
         }
     }
     // make sure $correlationName is a string
     $correlationName = Tinebase_Record_Abstract::generateUID() . $this->_value['cfId'] . 'cf';
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Adding custom field filter: ' . print_r($this->_value, true));
     }
     $db = Tinebase_Core::getDb();
     $idProperty = $db->quoteIdentifier($this->_options['idProperty']);
     // per left join we add a customfield column named as the customfield and filter this joined column
     // NOTE: we name the column we join like the customfield, to be able to join multiple customfield criteria (multiple invocations of this function)
     $what = array($correlationName => SQL_TABLE_PREFIX . 'customfield');
     $on = $db->quoteIdentifier("{$correlationName}.record_id") . " = {$idProperty} AND " . $db->quoteIdentifier("{$correlationName}.customfield_id") . " = " . $db->quote($this->_value['cfId']);
     $_select->joinLeft($what, $on, array());
     $valueIdentifier = $db->quoteIdentifier("{$correlationName}.value");
     if ($this->_value['value'] === '') {
         $where = $db->quoteInto($valueIdentifier . ' IS NULL OR ' . $valueIdentifier . ' = ?', $this->_value['value']);
     } else {
         $value = $this->_replaceWildcards($this->_value['value']);
         $where = $db->quoteInto($valueIdentifier . $this->_opSqlMap[$this->_operator]['sqlop'], $value);
     }
     $_select->where($where . ' /* add cf filter */');
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->_transactionId = Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_instance = Tinebase_CustomField::getInstance();
     Sales_Controller_Contract::getInstance()->setNumberPrefix();
     Sales_Controller_Contract::getInstance()->setNumberZerofill();
 }
 /**
  * Sets up the fixture.
  * 
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     // we need that because the voip db tables can have a different prefix
     Tinebase_Core::set('voipdbTablePrefix', SQL_TABLE_PREFIX);
     $phoneId = Tinebase_Record_Abstract::generateUID();
     $this->_objects['location'] = new Voipmanager_Model_Snom_Location(array('id' => Tinebase_Record_Abstract::generateUID(), 'name' => 'phpunit test location', 'registrar' => 'registrar'));
     $this->_objects['software'] = new Voipmanager_Model_Snom_Software(array('id' => Tinebase_Record_Abstract::generateUID()));
     $this->_objects['setting'] = new Voipmanager_Model_Snom_Setting(array('id' => Tinebase_Record_Abstract::generateUID(), 'name' => Tinebase_Record_Abstract::generateUID(), 'description' => Tinebase_Record_Abstract::generateUID(), 'language_w' => true));
     $this->_objects['phonesettings'] = new Voipmanager_Model_Snom_PhoneSettings(array('phone_id' => $phoneId, 'language' => 'Deutsch'));
     $this->_objects['template'] = new Voipmanager_Model_Snom_Template(array('id' => Tinebase_Record_Abstract::generateUID(), 'name' => 'phpunit test location', 'software_id' => $this->_objects['software']->getId(), 'setting_id' => $this->_objects['setting']->getId()));
     $this->_objects['phone'] = new Voipmanager_Model_Snom_Phone(array('id' => $phoneId, 'macaddress' => "1234567890cd", 'location_id' => $this->_objects['location']->getId(), 'template_id' => $this->_objects['template']->getId(), 'current_model' => 'snom320', 'redirect_event' => 'none'));
     $this->_objects['phoneOwner'] = array('account_id' => Zend_Registry::get('currentAccount')->getId(), 'account_type' => 'user');
     $rights = new Tinebase_Record_RecordSet('Voipmanager_Model_Snom_PhoneRight', array($this->_objects['phoneOwner']));
     $this->_objects['phone']->rights = $rights;
     // create phone, location, template
     $snomLocationBackend = new Voipmanager_Backend_Snom_Location();
     $snomTemplateBackend = new Voipmanager_Backend_Snom_Template();
     $snomSoftwareBackend = new Voipmanager_Backend_Snom_Software();
     $snomPhoneBackend = new Voipmanager_Backend_Snom_Phone();
     $snomSettingBackend = new Voipmanager_Backend_Snom_Setting();
     $snomPhoneSettingsBackend = new Voipmanager_Backend_Snom_PhoneSettings();
     $snomSoftwareBackend->create($this->_objects['software']);
     $snomLocationBackend->create($this->_objects['location']);
     $snomTemplateBackend->create($this->_objects['template']);
     $snomSettingBackend->create($this->_objects['setting']);
     $snomPhoneBackend->create($this->_objects['phone']);
     $snomPhoneSettingsBackend->create($this->_objects['phonesettings']);
 }
 /**
  * get a new single filter action
  *
  * @param string|array $_fieldOrData
  * @param string $_operator
  * @param mixed  $_value    
  * @param array  $_options
  * 
  * @todo remove legacy code + obsolete params sometimes
  */
 public function __construct($_fieldOrData, $_operator = NULL, $_value = NULL, array $_options = array())
 {
     $this->_db = Tinebase_Core::getDb();
     $this->_dbCommand = Tinebase_Backend_Sql_Command::factory($this->_db);
     if (is_array($_fieldOrData)) {
         $data = $_fieldOrData;
     } else {
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Using deprecated constructor syntax. Please pass all filter data in one array (filter field: ' . $_fieldOrData . ').');
         }
         $data = array('field' => $_fieldOrData, 'operator' => $_operator, 'value' => $_value, 'options' => $_options);
     }
     foreach (array('field', 'operator', 'value') as $requiredKey) {
         if (!(isset($data[$requiredKey]) || array_key_exists($requiredKey, $data))) {
             throw new Tinebase_Exception_InvalidArgument('Filter object needs ' . $requiredKey);
         }
     }
     $this->_setOptions(isset($data['options']) ? $data['options'] : array());
     $this->setField($data['field']);
     $this->setOperator($data['operator']);
     $this->setValue($data['value']);
     if (isset($data['id'])) {
         $this->setId($data['id']);
     }
     if (isset($data['label'])) {
         $this->setLabel($data['label']);
     }
 }
Пример #13
0
 /**
  * (non-PHPdoc)
  * @see ActiveSync/ActiveSync_TestCase::setUp()
  */
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_deviceBackend = new ActiveSync_Backend_DeviceFacade();
     $this->_folderBackend = new ActiveSync_Backend_FolderFacade();
     $this->_device = $this->_deviceBackend->create(ActiveSync_Backend_DeviceTests::getTestDevice());
 }
Пример #14
0
 /**
  * the constructor
  *
  * disabled. use the singleton
  * temporarly the constructor also creates the needed tables on demand and fills them with some initial values
  */
 private function __construct()
 {
     $this->_rolesTable = new Tinebase_Db_Table(array('name' => SQL_TABLE_PREFIX . 'roles'));
     $this->_roleMembersTable = new Tinebase_Db_Table(array('name' => SQL_TABLE_PREFIX . 'role_accounts'));
     $this->_roleRightsTable = new Tinebase_Db_Table(array('name' => SQL_TABLE_PREFIX . 'role_rights'));
     $this->_db = Tinebase_Core::getDb();
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_backend = Addressbook_Backend_Factory::factory(Addressbook_Backend_Factory::SQL);
     $personalContainer = Tinebase_Container::getInstance()->getPersonalContainer(Zend_Registry::get('currentAccount'), 'Addressbook', Zend_Registry::get('currentAccount'), Tinebase_Model_Grants::GRANT_EDIT);
     $this->_container = $personalContainer[0];
 }
 /**
  * appends sql to given select statement
  *
  * @param Zend_Db_Select                $_select
  * @param Tinebase_Backend_Sql_Abstract $_backend
  */
 public function appendFilterSql($_select, $_backend)
 {
     if (empty($this->_value)) {
         $_select->where('1=1/* empty query */');
         return;
     }
     $db = Tinebase_Core::getDb();
     switch ($this->_operator) {
         case 'contains':
         case 'equals':
         case 'startswith':
             $queries = explode(' ', $this->_value);
             foreach ($queries as $query) {
                 $whereParts = array();
                 foreach ($this->_options['fields'] as $qField) {
                     // if field has . in name, then we already have tablename
                     if (strpos($qField, '.') !== FALSE) {
                         $whereParts[] = Tinebase_Backend_Sql_Command::factory($db)->prepareForILike(Tinebase_Backend_Sql_Command::factory($db)->getUnaccent($db->quoteIdentifier($qField))) . ' ' . Tinebase_Backend_Sql_Command::factory($db)->getLike() . Tinebase_Backend_Sql_Command::factory($db)->prepareForILike(Tinebase_Backend_Sql_Command::factory($db)->getUnaccent('(?)'));
                     } else {
                         $whereParts[] = Tinebase_Backend_Sql_Command::factory($db)->prepareForILike(Tinebase_Backend_Sql_Command::factory($db)->getUnaccent($db->quoteIdentifier($_backend->getTableName() . '.' . $qField))) . ' ' . Tinebase_Backend_Sql_Command::factory($db)->getLike() . Tinebase_Backend_Sql_Command::factory($db)->prepareForILike(Tinebase_Backend_Sql_Command::factory($db)->getUnaccent('(?)'));
                     }
                 }
                 $whereClause = '';
                 if (!empty($whereParts)) {
                     $whereClause = implode(' OR ', $whereParts);
                 }
                 if (!empty($whereClause)) {
                     if ($this->_operator == 'equals') {
                         $_select->where($db->quoteInto($whereClause, trim($query)));
                     } else {
                         if ($this->_operator == 'startswith') {
                             $_select->where($db->quoteInto($whereClause, trim($query) . '%'));
                         } else {
                             $_select->where($db->quoteInto($whereClause, '%' . trim($query) . '%'));
                         }
                     }
                 }
             }
             break;
         case 'in':
             foreach ($this->_options['fields'] as $qField) {
                 // if field has . in name, then we allready have tablename
                 if (strpos($qField, '.') !== FALSE) {
                     $whereParts[] = $db->quoteInto($db->quoteIdentifier($qField) . ' IN (?)', (array) $this->_value);
                 } else {
                     $whereParts[] = $db->quoteInto($db->quoteIdentifier($_backend->getTableName() . '.' . $qField) . ' IN (?)', (array) $this->_value);
                 }
             }
             if (!empty($whereParts)) {
                 $whereClause = implode(' OR ', $whereParts);
             }
             if (!empty($whereClause)) {
                 $_select->where($whereClause);
             }
             break;
         default:
             throw new Tinebase_Exception_InvalidArgument('Operator not defined: ' . $this->_operator);
     }
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     Tinebase_Acl_Roles::getInstance()->resetClassCache();
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_json = new Timetracker_Frontend_Json();
     Sales_Controller_Contract::getInstance()->setNumberPrefix();
     Sales_Controller_Contract::getInstance()->setNumberZerofill();
 }
Пример #18
0
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_json = new Filemanager_Frontend_Json();
     $this->_fsController = Tinebase_FileSystem::getInstance();
     $this->_application = Tinebase_Application::getInstance()->getApplicationByName('Filemanager');
     $this->_setupTestContainers();
 }
Пример #19
0
 /**
  * (non-PHPdoc)
  * @see ActiveSync/ActiveSync_TestCase::setUp()
  */
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     Syncope_Registry::setDatabase(Tinebase_Core::getDb());
     Syncope_Registry::setTransactionManager(Tinebase_TransactionManager::getInstance());
     $testDevice = ActiveSync_Backend_DeviceTests::getTestDevice();
     $this->objects['device'] = ActiveSync_Controller_Device::getInstance()->create($testDevice);
 }
Пример #20
0
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_deviceBackend = new ActiveSync_Backend_DeviceFacade();
     $this->_folderBackend = new ActiveSync_Backend_FolderFacade();
     $this->_syncStateBackend = new Syncope_Backend_SyncState(Tinebase_Core::getDb(), SQL_TABLE_PREFIX . 'acsync_');
     $this->_device = $this->_deviceBackend->create(ActiveSync_Backend_DeviceTests::getTestDevice());
 }
Пример #21
0
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->objects['initialContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => Tinebase_Record_Abstract::generateUID(), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId())));
     Tinebase_Container::getInstance()->addGrants($this->objects['initialContainer'], Tinebase_Acl_Rights::ACCOUNT_TYPE_GROUP, Tinebase_Core::getUser()->accountPrimaryGroup, array(Tinebase_Model_Grants::GRANT_READ));
     // must be defined for Calendar/Frontend/WebDAV/Event.php
     $_SERVER['REQUEST_URI'] = 'foobar';
 }
 /**
  * appends sql to given select statement
  *
  * @param Zend_Db_Select                $_select
  * @param Tinebase_Backend_Sql_Abstract $_backend
  */
 public function appendFilterSql($_select, $_backend)
 {
     $db = Tinebase_Core::getDb();
     if (!is_array($this->_foreignIds)) {
         $this->_foreignIds = $this->_getController()->search($this->_filterGroup, new Tinebase_Model_Pagination(), FALSE, TRUE);
     }
     $_select->where($this->_getQuotedFieldName($_backend) . ' IN (?)', empty($this->_foreignIds) ? new Zend_Db_Expr('NULL') : $this->_foreignIds);
 }
Пример #23
0
 /**
  * tear down prefs
  */
 public function tearDown()
 {
     if ($this->_clearPrefs) {
         $query = Tinebase_Core::getDb()->quoteInto('DELETE FROM ' . SQL_TABLE_PREFIX . 'preferences WHERE application_id = ?', Tinebase_Application::getInstance()->getApplicationByName('Tinebase')->getId());
         Tinebase_Core::getDb()->query($query);
     }
     // reset tz in core
     Tinebase_Core::set(Tinebase_Core::USERTIMEZONE, Tinebase_Core::getPreference()->getValue(Tinebase_Preference::TIMEZONE));
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     // remove employees and costcenters, if there are some already
     $filter = new HumanResources_Model_EmployeeFilter(array());
     HumanResources_Controller_Employee::getInstance()->deleteByFilter($filter);
     $filter = new Sales_Model_CostCenterFilter(array());
     Sales_Controller_CostCenter::getInstance()->deleteByFilter($filter);
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     if (empty(Tinebase_Core::getConfig()->filesdir)) {
         $this->markTestSkipped('filesystem base path not found');
     }
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     Tinebase_FileSystem::getInstance()->initializeApplication(Tinebase_Application::getInstance()->getApplicationByName('Addressbook'));
     clearstatcache();
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     if (Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
         // account email addresses are empty with AD backend
         $this->markTestSkipped('skipped for ad backend');
     }
     Calendar_Controller_Event::getInstance()->sendNotifications(false);
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
 }
Пример #27
0
 protected function _getDb($_config)
 {
     $tine20DbConfig = Tinebase_Core::getDb()->getConfig();
     if ($this->_config['host'] == $tine20DbConfig['host'] && $this->_config['dbname'] == $tine20DbConfig['dbname'] && $this->_config['username'] == $tine20DbConfig['username']) {
         $this->_db = Tinebase_Core::getDb();
     } else {
         $this->_db = Zend_Db::factory('Pdo_Mysql', $_config);
     }
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     if (empty(Tinebase_Core::getConfig()->filesdir)) {
         $this->markTestSkipped('filesystem base path not found');
     }
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_basePath = 'tine20:///' . Tinebase_Application::getInstance()->getApplicationByName('Tinebase')->getId() . '/internal/phpunit';
     Tinebase_FileSystem::getInstance()->initializeApplication(Tinebase_Application::getInstance()->getApplicationByName('Tinebase'));
     clearstatcache();
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     if (!extension_loaded('redis')) {
         $this->markTestSkipped('redis extension not found');
     }
     if (!isset(Tinebase_Core::getConfig()->actionqueue) || !isset(Tinebase_Core::getConfig()->actionqueue->backend) || ucfirst(strtolower(Tinebase_Core::getConfig()->actionqueue->backend)) != Tinebase_ActionQueue::BACKEND_REDIS) {
         $this->markTestSkipped('no redis actionqueue configured');
     }
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
 }
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     if (empty(Tinebase_Core::getConfig()->filesdir)) {
         $this->markTestSkipped('filesystem base path not found');
     }
     Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     $this->_controller = new Tinebase_FileSystem();
     $this->_basePath = '/' . Tinebase_Application::getInstance()->getApplicationByName('Tinebase')->getId() . '/folders/' . Tinebase_Model_Container::TYPE_SHARED;
     $this->_controller->initializeApplication(Tinebase_Application::getInstance()->getApplicationByName('Tinebase'));
 }