pmEnDisUnListTest.php

  1. 6.x tests/pmEnDisUnListTest.php
  2. 4.x tests/pmEnDisUnListTest.php
  3. 5.x tests/pmEnDisUnListTest.php

Classes

Namesort descending Description
EnDisUnListCase

File

tests/pmEnDisUnListTest.php
View source
  1. <?php
  2. /*
  3. * @file
  4. * Tests for enable, disable, uninstall, pm-list commands.
  5. */
  6. class EnDisUnListCase extends Drush_TestCase {
  7. public function testEnDisUnList() {
  8. $this->setUpDrupal('dev', TRUE);
  9. $options = array(
  10. 'yes' => NULL,
  11. 'pipe' => NULL,
  12. 'root' => $this->sites['dev']['root'],
  13. 'uri' => 'dev',
  14. );
  15. $this->drush('pm-download', array('devel-7.x-1.0'), $options);
  16. $this->drush('pm-list', array(), $options + array('no-core' => NULL, 'status' => 'not installed'));
  17. $list = $this->getOutputAsList();
  18. $this->assertTrue(in_array('devel', $list));
  19. $this->drush('pm-enable', array('menu', 'devel'), $options);
  20. $this->drush('pm-list', array(), $options + array('status' => 'enabled'));
  21. $list = $this->getOutputAsList();
  22. $this->assertTrue(in_array('devel', $list));
  23. $this->assertTrue(in_array('bartik', $list), 'Themes are in the pm-list');
  24. $this->drush('pm-list', array(), $options + array('package' => 'Core'));
  25. $list = $this->getOutputAsList();
  26. $this->assertFalse(in_array('devel', $list), 'Devel is not part of core package');
  27. // For testing uninstall later.
  28. $this->drush('variable-set', array('devel_query_display', 1), $options);
  29. $this->drush('pm-disable', array('devel'), $options);
  30. $this->drush('pm-list', array(), $options + array('status' => 'disabled'));
  31. $list = $this->getOutputAsList();
  32. $this->assertTrue(in_array('devel', $list));
  33. $this->drush('pm-uninstall', array('devel'), $options);
  34. $this->drush('pm-list', array(), $options + array('status' => 'not installed', 'type' => 'module'));
  35. $list = $this->getOutputAsList();
  36. $this->assertTrue(in_array('devel', $list));
  37. // We expect an exit code of 1 so just call execute() directly.
  38. $exec = sprintf('%s variable-get %s --pipe --root=%s --uri=%s', UNISH_DRUSH, 'devel_query_display', $options['root'], $options['uri']);
  39. $this->execute($exec, self::EXIT_ERROR);
  40. $output = $this->getOutput();
  41. $this->assertEmpty($output, 'Devel variable was uninstalled.');
  42. }
  43. }