function pmUpdateStatus::setUp

8.0.x pmUpdateStatusTest.php pmUpdateStatus::setUp()
7.x pmUpdateStatusTest.php pmUpdateStatus::setUp()
master pmUpdateStatusTest.php pmUpdateStatus::setUp()

Setup the test environment.

Here we assume that any Drupal core version parses data from Drupal's update service the same way. We focus on testing drush functionality.

Several drupal core versions are already tested by pmUpdateCode.

We choose to setup a Drupal 7 environment for convenience:

  • It has modules in each maintenance status and they're not willing to change in short
  • Drupal 8 still has not enough variety to cover the tests


tests/pmUpdateStatusTest.php, line 29
Prepare a codebase with modules in several update status and test pm-updatestatus.




@group slow @group pm


function setUp() {
  $sites = $this->setUpDrupal(1, TRUE, "7.30");
  $options = array(
    'root' => $this->webroot(),
    'uri' => key($sites),
    'yes' => NULL,
    'cache' => NULL,
    'skip' => NULL, // No FirePHP
    'strict' => 0,

  // Prepare a list of modules with several update statuses.
  $modules_dl = array();
  $modules_en = array();
  // Update available but not a security one. Cross fingers they never release a security update.
  $modules_dl[] = 'bad_judgement-1.0-rc38';
  $modules_en[] = 'bad_judgement';
  // Old devel release with a security update available.
  $modules_dl[] = 'devel-7.x-1.0-rc1';
  $modules_en[] = 'devel';
  // Installed version not supported.
  $modules_dl[] = 'cck-2.x-dev';
  $modules_en[] = 'cck';
  // Up to date.
  $modules_dl[] = 'ctools';
  $modules_en[] = 'ctools';

  // Download and enable the modules. Additionally download a module from git, so it has no version information.
  $this->drush('pm-download', $modules_dl, $options);
  $this->drush('pm-download', array('zen'), $options + array('package-handler' => 'git_drupalorg'));
  $modules_en[] = 'zen';
  // self::EXIT_ERROR because of bad_judgement.
  $this->drush('pm-enable', $modules_en, $options, NULL, NULL, self::EXIT_ERROR);