Skip to content

Commit

Permalink
adding the cd - like site-set -test and @none assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
joelpittet committed Sep 30, 2017
1 parent 1d11693 commit 82e050e
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions tests/siteSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,26 @@ public function testSiteSet()
}
$sites = $this->setUpDrupal(2, true);
$site_names = array_keys($sites);
$alias = '@' . $site_names[0];
$this->assertCount(2, $site_names, 'Has 2 drupal sites setup');
// Test changing aliases.
foreach ($site_names as $site_name) {
$this->drush('site-set', ['@' . $site_name]);
$output = $this->getErrorOutput();
$this->assertEquals('[success] Site set to @' . $site_name, $output);
}
// Toggle between the previous set alias and back again.
$this->drush('site-set', ['-']);
$output = $this->getErrorOutput();
$this->assertEquals('[success] Site set to @' . $site_names[0], $output);
$this->drush('site-set', ['-']);
$output = $this->getErrorOutput();
$this->assertEquals('[success] Site set to @' . $site_names[1], $output);

$this->drush('ev', array("drush_invoke('site-set', '$alias'); print drush_sitealias_site_get();"));
$output = $this->getOutput();
$this->assertEquals($alias, $output);
// Test setting the site to the special @none alias.
$this->drush('site-set', ['@none']);
$output = $this->getErrorOutput();
$this->assertEquals('[success] Site unset.', $output);

$this->drush('ev', array("drush_invoke('site-set', '@none'); print drush_sitealias_site_get();"));
$output = $this->getOutput();
$this->assertEquals('', $output);
}

}
}

0 comments on commit 82e050e

Please sign in to comment.