class siteUpgradeCase


Expanded class hierarchy of siteUpgradeCase


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 -
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
siteUpgradeCase::testUpgrade function


tests/siteUpgradeTest.php, line 15

View source
class siteUpgradeCase extends Drush_TestCase {
  function testUpgrade() {
    $env = 'testupgrade';
    $this->setUpDrupal($env, TRUE, '6.x');
    $root = $this->sites[$env]['root'];

    // Create the alias for D7 site.
    $aliases['target'] = array(
      'root' => UNISH_SANDBOX . '/target',
      'uri' => $env,
      'db-url' => UNISH_DB_URL . '/unish_target',
    $contents = $this->file_aliases($aliases);
    $alias_path = "$root/aliases.drushrc.php";
    file_put_contents($alias_path, $contents);

    // Create a user in D6.
    $name = "example";
    $options = array(
      'mail' => "",
      'password' => 'password',
      'root' => $root,
      'uri' => $env,
    $this->drush('user-create', array($name), $options);

    // Perform the upgrade.
    $options = array(
      'yes' => NULL,
      'root' => $root,
      'uri' => $env,
    $this->drush('site-upgrade', array('@target'), $options);

    // Assert that the D7 site bootstraps.
    // We don't specify @target alias since that file is in the root of the *source* site.
    $options = array(
      'pipe' => NULL,
      'root' => $aliases['target']['root'],
      'uri' => $aliases['target']['uri'],
    $return = $this->drush('core-status', array('drupal_bootstrap'), $options);
    $this->assertEquals('Successful', $this->getOutput(), 'The target site bootstraps successfully');

    // Assures that a updatedb and batch updates work properly. See user_update_7001().
    $options = array(
      'root' => $aliases['target']['root'],
      'uri' => $aliases['target']['uri'],
    $eval = "require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/');";
    $eval .= "\$account = user_load_by_name('example');";
    $eval .= "print (string) user_check_password('password', \$account)";
    $this->drush('php-eval', array($eval), $options);
    $output = $this->getOutput();
    $this->assertSame('1', $output, 'User was updated to new password format.');