public function setUp() { SugarCache::$isCacheReset = false; if (empty($GLOBALS['current_language'])) { $GLOBALS['current_language'] = $GLOBALS['sugar_config']['default_language']; } }
public function tearDown() { if ($this->module_installer) { $this->module_installer->uninstall_extensions(); } if (file_exists($this->module_installer->base_dir . "/test.ext.php")) { @unlink($this->module_installer->base_dir . "/test.ext.php"); } SugarCache::$isCacheReset = false; }
public function tearDown() { // clear out the test cache if we haven't already if (sugar_cache_retrieve($this->_cacheKey1)) { sugar_cache_clear($this->_cacheKey1); } if (sugar_cache_retrieve($this->_cacheKey2)) { sugar_cache_clear($this->_cacheKey2); } if (sugar_cache_retrieve($this->_cacheKey3)) { sugar_cache_clear($this->_cacheKey3); } SugarCache::$isCacheReset = false; }
public function tearDown() { $this->removeCustomAppStrings(); $this->removeModuleStrings(array('Accounts')); SugarTestUserUtilities::removeAllCreatedAnonymousUsers(); unset($GLOBALS['current_user']); unset($GLOBALS['beanList']); unset($GLOBALS['beanFiles']); SugarCache::$isCacheReset = false; if (!empty($this->language_contents)) { foreach ($this->language_contents as $key => $contents) { sugar_file_put_contents("custom/modules/{$key}/language/en_us.lang.php", $contents); } } }
public function tearDown() { $mbc = new ModuleBuilderController(); $this->currencyFieldDef1['name'] = 'c1_c'; $_REQUEST = $this->currencyFieldDef1; $mbc->action_DeleteField(); $this->currencyFieldDef2['name'] = 'c2_c'; $_REQUEST = $this->currencyFieldDef2; $mbc->action_DeleteField(); SugarTestUserUtilities::removeAllCreatedAnonymousUsers(); unset($GLOBALS['current_user']); unset($GLOBALS['beanList']); unset($GLOBALS['beanFiles']); unset($GLOBALS['app_list_strings']); $_REQUEST = array(); SugarCache::$isCacheReset = false; }
/** * Clean up all registered variables and restore $initVars and $systemVars * @static * @return bool status of tearDown */ public static function tearDown() { self::init(); foreach (self::$registeredVars as $varName => $isCalled) { if ($isCalled) { unset(self::$registeredVars[$varName]); if (method_exists(__CLASS__, 'tearDown_' . $varName)) { call_user_func(__CLASS__ . '::tearDown_' . $varName, array()); } elseif (isset($GLOBALS[$varName])) { unset($GLOBALS[$varName]); } } } // Restoring of system variables foreach (self::$initVars as $scope => $vars) { foreach ($vars as $name => $value) { $GLOBALS[$scope][$name] = $value; } } // Restoring of theme SugarThemeRegistry::set(self::$systemVars['SugarThemeRegistry']->dirName); SugarCache::$isCacheReset = false; return true; }
/** * Reset the cache for this request */ public function reset() { $this->_localStore = array(); SugarCache::$isCacheReset = true; }
public function testHandleRemainingRelateFields() { // create a test relationship // save cache reset value $_cacheResetValue = SugarCache::$isCacheReset; //$rel = $this->createRelationship('Accounts'); $rel = SugarTestRelationshipUtilities::createRelationship(array('relationship_type' => 'one-to-many', 'lhs_module' => 'Accounts', 'rhs_module' => 'Accounts')); if ($rel == false) { $this->fail('Relationship Not Created'); } $rel_name = $rel->getName(); $id = $rel->getIDName('Accounts'); $acc1 = SugarTestAccountUtilities::createAccount(); $acc2 = SugarTestAccountUtilities::createAccount(); $macc = new MockAccountSugarBean(); $macc->disable_row_level_security = true; $macc->retrieve($acc2->id); $macc->{$id} = $acc1->id; $ret = $macc->handle_remaining_relate_fields(); $this->assertContains($rel_name, $ret['add']['success']); $macc->rel_fields_before_value[$id] = $acc1->id; $macc->{$id} = ''; $ret = $macc->handle_remaining_relate_fields(); $this->assertContains($rel_name, $ret['remove']['success']); // variable cleanup // delete the test relationship //$this->removeRelationship($rel_name, 'Accounts'); SugarTestRelationshipUtilities::removeAllCreatedRelationships(); unset($macc); SugarTestAccountUtilities::removeAllCreatedAccounts(); // reset the isCacheReset Value since this is all one request. SugarCache::$isCacheReset = $_cacheResetValue; }
public function tearDown() { if (!empty($this->_savedSearchDefs)) { file_put_contents("custom/modules/ProjectTask/metadata/searchdefs.php", $this->_savedSearchDefs); } else { @unlink("custom/modules/ProjectTask/metadata/searchdefs.php"); } if (!empty($this->_savedSearchFields)) { file_put_contents("modules/ProjectTask/metadata/SearchFields.php", $this->_savedSearchFields); } else { @unlink("modules/ProjectTask/metadata/SearchFields.php"); } SugarTestProjectTaskUtilities::removeAllCreatedProjectTasks(); SugarTestProjectUtilities::removeAllCreatedProjects(); SugarTestAccountUtilities::removeAllCreatedAccounts(); $this->relationships->delete($this->relationship->getName()); $this->relationships->save(); parent::tearDown(); SugarCache::$isCacheReset = false; SugarTestHelper::tearDown(); $GLOBALS['reload_vardefs'] = true; $bean = new ProjectTask(); unset($GLOBALS['reload_vardefs']); }