UnitUnishTestCase.php

  1. 8.0.x tests/Unish/UnitUnishTestCase.php
  2. 7.x tests/Unish/UnitUnishTestCase.php
  3. master tests/Unish/UnitUnishTestCase.php

Namespace

Unish

Classes

Namesort ascending Description
UnitUnishTestCase Base class for Drush unit tests

File

tests/Unish/UnitUnishTestCase.php
View source
  1. <?php
  2. namespace Unish;
  3. /**
  4. * Base class for Drush unit tests
  5. *
  6. * Those tests will run in a bootstrapped Drush environment
  7. *
  8. * This should be ran in separate processes, which the following
  9. * annotation should do in 3.6 and above:
  10. *
  11. * @runTestsInSeparateProcesses
  12. */
  13. abstract class UnitUnishTestCase extends UnishTestCase {
  14. /**
  15. * Minimally bootstrap drush
  16. *
  17. * This is equivalent to the level DRUSH_BOOTSTRAP_NONE, as we
  18. * haven't run drush_bootstrap() yet. To do anything, you'll need to
  19. * bootstrap to some level using drush_bootstrap().
  20. *
  21. * @see drush_bootstrap()
  22. */
  23. public static function setUpBeforeClass() {
  24. parent::setUpBeforeClass();
  25. require_once(__DIR__ . '/../../includes/preflight.inc');
  26. drush_preflight_prepare();
  27. // Need to set DRUSH_COMMAND so that drush will be called and not phpunit
  28. define('DRUSH_COMMAND', UNISH_DRUSH);
  29. }
  30. public static function tearDownAfterClass() {
  31. parent::tearDownAfterClass();
  32. \drush_postflight();
  33. }
  34. function drush_major_version() {
  35. return DRUSH_MAJOR_VERSION;
  36. }
  37. }