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. * @group commands
  7. */
  8. class VariableCase extends Drush_CommandTestCase {
  9. function testVariable() {
  10. $sites = $this->setUpDrupal(1, TRUE);
  11. $options = array(
  12. 'yes' => NULL,
  13. 'pipe' => NULL,
  14. 'root' => $this->webroot(),
  15. 'uri' => key($sites),
  16. );
  17. $this->drush('variable-set', array('date_default_timezone', 'US/Mountain'), $options);
  18. $this->drush('variable-get', array('date_default_timezone'), $options); // Wildcard get.
  19. $var_export = $this->getOutput();
  20. eval($var_export);
  21. $this->assertEquals('US/Mountain', $variables['date_default_timezone'], 'Variable was successfully set and get.');
  22. $this->drush('variable-set', array('site_name', 'control'), $options + array('exact' => NULL));
  23. $this->drush('variable-set', array('site_na', 'unish'), $options + array('always-set' => NULL));
  24. $this->drush('variable-get', array('site_na'), $options + array('exact' => NULL));
  25. $var_export = $this->getOutput();
  26. eval($var_export);
  27. $this->assertEquals('unish', $variables['site_na'], '--always-set option works as expected.');
  28. $this->drush('variable-set', array('site_n', 'exactish'), $options + array('exact' => NULL));
  29. $this->drush('variable-get', array('site_n'), $options + array('exact' => NULL));
  30. $var_export = $this->getOutput();
  31. eval($var_export);
  32. $this->assertEquals('exactish', $variables['site_n'], '--exact option works as expected.');
  33. $this->drush('variable-delete', array('site_name'), $options);
  34. $output = $this->getOutput();
  35. $this->assertEmpty($output, 'Variable was successfully deleted.');
  36. }
  37. }