Skip to content

Commit

Permalink
Annotated commands tests for Drupal 6.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson committed Apr 22, 2016
1 parent 84af0d3 commit 8acb695
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 16 deletions.
22 changes: 6 additions & 16 deletions tests/annotatedCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ public function testExecute() {
);

// Copy the 'woot' module over to the Drupal site we just set up.
if (UNISH_DRUPAL_MAJOR_VERSION == 8) {
$this->setupModulesForDrupal8($root);
}
else {
$this->setupModulesForDrupal6and7($root);
}
$this->setupModulesForTests($root);

// Enable out module. This will also clear the commandfile cache.
$this->drush('pm-enable', array('woot'), $options, NULL, NULL, self::EXIT_SUCCESS);
Expand Down Expand Up @@ -81,18 +76,13 @@ public function testExecute() {
$this->drush('cache-clear', array('drush'), $options, NULL, NULL, self::EXIT_SUCCESS);
}

public function setupModulesForDrupal8($root) {
$woot8Module = __DIR__ . '/resources/modules/d8/woot';
$modulesDir = "$root/modules";
\symlink($woot8Module, "$modulesDir/woot");
}

public function setupModulesForDrupal6and7($root) {
$wootModule = __DIR__ . '/resources/modules/d7/woot';
$woot8Module = __DIR__ . '/resources/modules/d8/woot';
public function setupModulesForTests($root) {
$wootModule = __DIR__ . '/resources/modules/d' . UNISH_DRUPAL_MAJOR_VERSION . '/woot';
$modulesDir = "$root/sites/all/modules";
$this->mkdir($modulesDir);
\symlink($wootModule, "$modulesDir/woot");
if (!file_exists("$wootModule/Command/WootCommands.php")) {
if ((UNISH_DRUPAL_MAJOR_VERSION < 8) && !file_exists("$wootModule/Command/WootCommands.php")) {
$woot8Module = __DIR__ . '/resources/modules/d8/woot';
\symlink("$woot8Module/src/Command/WootCommands.php", "$wootModule/Command/WootCommands.php");
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/resources/modules/d6/woot/Command/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WootCommands.php
4 changes: 4 additions & 0 deletions tests/resources/modules/d6/woot/woot.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name = woot
description = Woot Mightily
core = 6.x
files[] = woot.module
22 changes: 22 additions & 0 deletions tests/resources/modules/d6/woot/woot.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* Implements hook_menu
*/
function woot_menu() {
$items = array();

$items['woot'] = array(
'title' => 'Woot',
'description' => 'Woot mightily.',
'page callback' => 'woot_page',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);

return $items;
}

function woot_page() {
return array('#markup' => 'Woot!');
}

0 comments on commit 8acb695

Please sign in to comment.