pmEnDisUnListTest.php

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

Tests for enable, disable, uninstall, pm-list commands.

Classes

Namesort descending Description
EnDisUnListCase @group slow @group pm

File

tests/pmEnDisUnListTest.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Tests for enable, disable, uninstall, pm-list commands.
  5. */
  6. /**
  7. * @group slow
  8. * @group pm
  9. */
  10. class EnDisUnListCase extends Drush_CommandTestCase {
  11. public function testEnDisUnList() {
  12. $sites = $this->setUpDrupal(1, TRUE);
  13. $options = array(
  14. 'yes' => NULL,
  15. 'pipe' => NULL,
  16. 'root' => $this->webroot(),
  17. 'uri' => key($sites),
  18. 'cache' => NULL,
  19. 'skip' => NULL, // No FirePHP
  20. 'invoke' => NULL, // Don't validate options
  21. );
  22. $this->drush('pm-download', array('devel'), $options);
  23. $this->drush('pm-list', array(), $options + array('no-core' => NULL, 'status' => 'not installed'));
  24. $list = $this->getOutputAsList();
  25. $this->assertTrue(in_array('devel', $list));
  26. $this->drush('pm-enable', array('devel'), $options);
  27. $this->drush('pm-list', array(), $options + array('status' => 'enabled'));
  28. $list = $this->getOutputAsList();
  29. $this->assertTrue(in_array('devel', $list));
  30. $this->assertTrue(in_array('bartik', $list), 'Themes are in the pm-list');
  31. $this->drush('sql-query', array("SELECT path FROM menu_router WHERE path = 'devel/settings';"), array('root' => $this->webroot(), 'uri' => key($sites)));
  32. $list = $this->getOutputAsList();
  33. $this->assertTrue(in_array('devel/settings', $list), 'Cache was cleared after modules were enabled');
  34. $this->drush('pm-list', array(), $options + array('package' => 'Core'));
  35. $list = $this->getOutputAsList();
  36. $this->assertFalse(in_array('devel', $list), 'Devel is not part of core package');
  37. // For testing uninstall later.
  38. $this->drush('variable-set', array('devel_query_display', 1), $options);
  39. $this->drush('pm-disable', array('devel'), $options);
  40. $this->drush('pm-list', array(), $options + array('status' => 'disabled'));
  41. $list = $this->getOutputAsList();
  42. $this->assertTrue(in_array('devel', $list));
  43. $this->drush('pm-uninstall', array('devel'), $options);
  44. $this->drush('pm-list', array(), $options + array('status' => 'not installed', 'type' => 'module'));
  45. $list = $this->getOutputAsList();
  46. $this->assertTrue(in_array('devel', $list));
  47. $this->drush('variable-get', array('devel_query_display'), $options, NULL, NULL, self::EXIT_ERROR);
  48. $output = $this->getOutput();
  49. $this->assertEmpty($output, 'Devel variable was uninstalled.');
  50. // Test pm-enable is able to download dependencies.
  51. $this->drush('pm-download', array('pathauto'), $options);
  52. $this->drush('pm-enable', array('pathauto'), $options + array('resolve-dependencies' => TRUE));
  53. $this->drush('pm-list', array(), $options + array('status' => 'enabled'));
  54. $list = $this->getOutputAsList();
  55. $this->assertTrue(in_array('token', $list));
  56. // Test that pm-enable downloads missing projects and dependencies.
  57. $this->drush('pm-enable', array('views'), $options + array('resolve-dependencies' => TRUE));
  58. $this->drush('pm-list', array(), $options + array('status' => 'enabled'));
  59. $list = $this->getOutputAsList();
  60. $this->assertTrue(in_array('ctools', $list));
  61. }
  62. }