variableTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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. }