class VariableCase

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

Hierarchy

Expanded class hierarchy of VariableCase

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
Drush_TestCase::create_node_types_php function
Drush_TestCase::drush function Invoke drush in via execute().
Drush_TestCase::drush_major_version function
Drush_TestCase::escapeshellarg public static function
Drush_TestCase::execute function Actually runs the command. Does not trap the error stream output as this need PHP 4.3+.
Drush_TestCase::EXIT_ERROR constant
Drush_TestCase::EXIT_SUCCESS constant
Drush_TestCase::file_aliases function
Drush_TestCase::file_delete_recursive function Same code as drush_delete_dir().
Drush_TestCase::getOutput function Accessor for the last output.
Drush_TestCase::getOutputAsList function Accessor for the last output.
Drush_TestCase::is_windows public static function
Drush_TestCase::setUpBeforeClass public static function Assure that each class starts with an empty sandbox directory and a clean environment - http://drupal.org/node/1103568.
Drush_TestCase::setUpDrupal function
Drush_TestCase::tearDownAfterClass public static function Runs after each test case. Remove sandbox directory.
Drush_TestCase::_escapeshellarg_windows public static function
Drush_TestCase::__construct function
VariableCase::testVariable function

File

tests/variableTest.php, line 7

View source
class VariableCase extends Drush_TestCase {

  function testVariable() {
    $env = 'dev';
    $this->setUpDrupal($env, TRUE);
    $options = array(
      'yes' => NULL,
      'pipe' => NULL,
      'root' => $this->sites[$env]['root'],
      'uri' => $env,
    );

    $this->drush('variable-set', array('date_default_timezone', 'US/Mountain'), $options);
    $this->drush('variable-get', array('date_default_timezone'), $options); // Wildcard get.
    $var_export = $this->getOutput();
    eval($var_export);
    $this->assertEquals('US/Mountain', $variables['date_default_timezone'], 'Variable was successfully set and get.');

    $this->drush('variable-set', array('site_name', 'unish'), $options + array('always-set' => NULL));
    $this->drush('variable-get', array('site_name'), $options);
    $var_export = $this->getOutput();
    eval($var_export);
    $this->assertEquals('unish', $variables['site_name'], '--always-set option works as expected.');

    $this->drush('variable-delete', array('site_name'), $options);
    $output = $this->getOutput();
    $this->assertEmpty($output, 'Variable was successfully deleted.');
  }
}