variableTest.php

  1. 8.0.x tests/variableTest.php
  2. 6.x tests/variableTest.php
  3. 7.x tests/variableTest.php
  4. 4.x tests/variableTest.php
  5. 5.x tests/variableTest.php
  6. master tests/variableTest.php

Classes

Namesort descending Description
VariableCase

File

tests/variableTest.php
View source
  1. <?php
  2. /*
  3. * @file
  4. * Tests for enable, disable, uninstall, pm-list commands.
  5. */
  6. class VariableCase extends Drush_TestCase {
  7. function testVariable() {
  8. $env = 'dev';
  9. $this->setUpDrupal($env, TRUE);
  10. $options = array(
  11. 'yes' => NULL,
  12. 'pipe' => NULL,
  13. 'root' => $this->sites[$env]['root'],
  14. 'uri' => $env,
  15. );
  16. $this->drush('variable-set', array('date_default_timezone', 'US/Mountain'), $options);
  17. $this->drush('variable-get', array('date_default_timezone'), $options); // Wildcard get.
  18. $var_export = $this->getOutput();
  19. eval($var_export);
  20. $this->assertEquals('US/Mountain', $variables['date_default_timezone'], 'Variable was successfully set and get.');
  21. $this->drush('variable-set', array('site_name', 'unish'), $options + array('always-set' => NULL));
  22. $this->drush('variable-get', array('site_name'), $options);
  23. $var_export = $this->getOutput();
  24. eval($var_export);
  25. $this->assertEquals('unish', $variables['site_name'], '--always-set option works as expected.');
  26. $this->drush('variable-delete', array('site_name'), $options);
  27. $output = $this->getOutput();
  28. $this->assertEmpty($output, 'Variable was successfully deleted.');
  29. }
  30. }