class sqlSyncTest

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


Expanded class hierarchy of sqlSyncTest


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
sqlSyncTest::testLocalSqlSync public function


tests/sqlSyncTest.php, line 11

View source
class sqlSyncTest extends Drush_TestCase {

   * Covers the following responsibilities.
   *   - A user created on the source site is copied to the destination site.
   *   - The email address of the copied user is sanitized on the destination site.
   * General handling of site aliases will be in sitealiasTest.php.
  public function testLocalSqlSync() {
    $this->setUpDrupal('dev', TRUE);
    $this->setUpDrupal('stage', TRUE);
    $dump_dir = UNISH_SANDBOX . "/dump-dir";

    // Create a user in the staging site
    $name = 'joe.user';
    $mail = "";
    $options = array(
      'root' => $this->sites['stage']['root'],
      'uri' => 'stage',
      'yes' => NULL,
    $this->drush('user-create', array($name), $options + array('password' => 'password', 'mail' => $mail));

    // Copy stage to dev with --sanitize
    $sync_options = array(
      'sanitize' => NULL,
      'yes' => NULL,
      'dump-dir' => $dump_dir,
    $this->drush('sql-sync', array('@stage', '@dev'), $sync_options);

    // Confirm that the sample user has the correct email address on the staging site
    $this->drush('user-information', array($name), $options + array('pipe' => NULL));
    $output = $this->getOutput();
    $row = str_getcsv($output);
    $uid = $row[1];
    $this->assertEquals($mail, $row[2], 'email address is unchanged on source site.');
    $this->assertEquals($name, $row[0]);

    $options = array(
      'root' => $this->sites['dev']['root'],
      'uri' => 'dev',
      'yes' => NULL,
    // Confirm that the sample user's email address has been sanitized on the dev site
    $this->drush('user-information', array($name), $options + array('pipe' => NULL));
    $output = $this->getOutput();
    $row = str_getcsv($output);
    $uid = $row[1];
    $this->assertEquals("user+2@localhost", $row[2], 'email address was sanitized on destination site.');
    $this->assertEquals($name, $row[0]);