function UpgradePathTestCase::variable_set

Specialized variable_set() that works even if the child site is not upgraded.

Parameters

$name: The name of the variable to set.

$value: The value to set. This can be any PHP data type; these functions take care of serialization as necessary.

5 calls to UpgradePathTestCase::variable_set()
LocaleUpgradePathTestCase::testLocaleUpgradeDomain in modules/simpletest/tests/upgrade/upgrade.locale.test
Test an upgrade with domain-based negotiation.
LocaleUpgradePathTestCase::testLocaleUpgradePathDefault in modules/simpletest/tests/upgrade/upgrade.locale.test
Test an upgrade with path-based negotiation.
LocaleUpgradePathTestCase::testLocaleUpgradePathFallback in modules/simpletest/tests/upgrade/upgrade.locale.test
Test an upgrade with path-based (with fallback) negotiation.
UpgradePathTestCase::setUp in modules/simpletest/tests/upgrade/upgrade.test
Overrides DrupalWebTestCase::setUp() for upgrade testing.
UploadUpgradePathTestCase::setUp in modules/simpletest/tests/upgrade/upgrade.upload.test
Overrides DrupalWebTestCase::setUp() for upgrade testing.

File

modules/simpletest/tests/upgrade/upgrade.test, line 176

Class

UpgradePathTestCase
Perform end-to-end tests of the upgrade path.

Code

protected function variable_set($name, $value) {
    db_delete('variable')->condition('name', $name)
        ->execute();
    db_insert('variable')->fields(array(
        'name' => $name,
        'value' => serialize($value),
    ))
        ->execute();
    try {
        cache_clear_all('variables', 'cache');
        cache_clear_all('variables', 'cache_bootstrap');
    } catch (Exception $e) {
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.