initCommandTest.php

  1. 8.0.x tests/initCommandTest.php
  2. master tests/initCommandTest.php

Namespace

Unish

Classes

Namesort descending Description
initCommandCase Test to see if the `drush init` command does the setup that it is supposed to do.

File

tests/initCommandTest.php
View source
  1. <?php
  2. namespace Unish;
  3. /**
  4. * Test to see if the `drush init` command does the
  5. * setup that it is supposed to do.
  6. *
  7. * @group base
  8. */
  9. class initCommandCase extends CommandUnishTestCase {
  10. function testInitCommand() {
  11. // Call `drush core-init`
  12. $this->drush('core-init', array(), array('backend' => NULL, 'add-path' => TRUE));
  13. $parsed = $this->parse_backend_output($this->getOutput());
  14. // First test to ensure that the command claimed to have made the expected progress
  15. $this->assertLogHasMessage($parsed['log'], "Copied example Drush configuration file", 'ok');
  16. $this->assertLogHasMessage($parsed['log'], "Copied example Drush bash configuration file", 'ok');
  17. $this->assertLogHasMessage($parsed['log'], "Updated bash configuration file", 'ok');
  18. // Next we will test to see if there is evidence that those
  19. // operations worked.
  20. $home = getenv("HOME");
  21. $this->assertFileExists("$home/.drush/drushrc.php");
  22. $this->assertFileExists("$home/.drush/drush.bashrc");
  23. $this->assertFileExists("$home/.bashrc");
  24. // Check to see if the .bashrc file sources our drush.bashrc file,
  25. // and whether it adds the path to UNISH_DRUSH to the $PATH
  26. $bashrc_contents = file_get_contents("$home/.bashrc");
  27. $this->assertContains('drush.bashrc', $bashrc_contents);
  28. $this->assertContains(dirname(UNISH_DRUSH), $bashrc_contents);
  29. }
  30. }