With the core testing, how do I set a database variable?
drupalVariableSet() has been removed as per Remove drupalVariableSet.

variable_set() is the function you should use. In fact, DrupalWebTestCase::setUp() uses it for some persistent variables used from Drupal core, right after the call to drupal_install_system().

  // Perform the actual Drupal installation.
  include_once DRUPAL_ROOT . '/includes/install.inc';
  drupal_install_system();

  $this-&gt;preloadRegistry();

  // Set path variables.
  variable_set('file_public_path', $this-&gt;public_files_directory);
  variable_set('file_private_path', $this-&gt;private_files_directory);
  variable_set('file_temporary_path', $this-&gt;temp_files_directory);

  // Set the 'simpletest_parent_profile' variable to add the parent profile's
  // search path to the child site's search paths.
  // @see drupal_system_listing()
  // @todo This may need to be primed like 'install_profile' above.
  variable_set('simpletest_parent_profile', $this-&gt;originalProfile);


As long as the following conditions are met, using variable_set() should work as expected.


The test class derives from DrupalWebTestCase and not from DrupalTestCase
variable_set() is called after parent::setUp()
The name of the persistent variable used in variable_set() doesn't contain typos