Index: review/simpletest/pifr_simpletest.client.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/simpletest/pifr_simpletest.client.inc,v
retrieving revision 1.13
diff -u -r1.13 pifr_simpletest.client.inc
--- review/simpletest/pifr_simpletest.client.inc	7 Dec 2009 22:56:37 -0000	1.13
+++ review/simpletest/pifr_simpletest.client.inc	7 Dec 2009 23:21:22 -0000
@@ -11,244 +11,18 @@
 /**
  * SimpleTest PIFR review implementation.
  */
-class pifr_client_review_pifr_simpletest extends pifr_client_review {
+class pifr_client_review_pifr_simpletest extends pifr_client_review_pifr_drupal {
 
   /**
-   * Drupal core CVS URL.
-   */
-  protected $core_url = ':pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/drupal';
-
-  /**
-   * Location of default sites module directory.
-   */
-  protected $module_directory = 'sites/default/modules';
-
-  /**
-   * Administrator password used when installing Drupal.
-   */
-  protected $admin_password;
-
-  /**
-   * Add install and test steps.
+   * Add test operation.
    */
   public function __construct(array $test) {
     parent::__construct($test);
 
-    if ($this->test['vcs']['main']['repository']['url'] != $this->core_url) {
-      // Main repository is not core, so this must be a module test. Move the
-      // module repository (main) to the dependencies and find the core
-      // repository int he dependencies and move it to main.
-      $this->test['vcs']['dependencies'][] = $this->test['vcs']['main'];
-
-      foreach ($this->test['vcs']['dependencies'] as $key => $dependency) {
-        if ($dependency['repository']['url'] == $this->core_url) {
-          $this->test['vcs']['main'] = $dependency;
-          unset($this->test['vcs']['dependencies'][$key]);
-          break;
-        }
-      }
-    }
-
-    if ($this->test['review']['argument']['core'] == 6) {
-      // Since SimpleTest is not included in Drupal 6 it needs to be
-      // checked out from contrib.
-      $this->test['vcs']['dependencies'][] = array(
-        'repository' => array(
-          'type' => 'cvs',
-          'url' => ':pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib/contributions/modules/simpletest',
-        ),
-        'vcs_identifier' => 'DRUPAL-6--2',
-      );
-    }
-
-    $this->operations[] = 'install';
     $this->operations[] = 'test';
   }
 
   /**
-   * Checkout dependencies into the modules directory.
-   */
-  protected function checkout() {
-    // Checkout Drupal core.
-    parent::checkout();
-
-    if (!$this->has_error()) {
-      // Checkout modules if specified.
-      if (!empty($this->test['vcs']['dependencies'])) {
-        $directory = $this->checkout_directory . '/' . $this->module_directory;
-        if (!file_check_directory($directory, FILE_CREATE_DIRECTORY)) {
-          $this->set_error(array('@reason' => 'failed to create modules directory'));
-          return;
-        }
-
-        // Checkout module dependencies into the modules directory.
-        $this->checkout_dependencies($this->test['vcs']['dependencies']);
-      }
-    }
-  }
-
-  /**
-   * Checkout the list of dependencies into the modules directory.
-   *
-   * @param array $dependencies List of dependencies VCS information.
-   */
-  protected function checkout_dependencies(array $dependencies) {
-    $directory = $this->checkout_directory . '/' . $this->module_directory;
-    foreach ($dependencies as $dependency) {
-      $this->checkout_branch($dependency, $directory);
-
-      $display = $this->checkout_display($dependency);
-      if ($this->has_error()) {
-        $this->log('Dependency [' . $display . '] checkout failed.');
-        break;
-      }
-
-      $this->log('Dependency [' . $display . '] checkout complete.');
-    }
-  }
-
-  /**
-   * Apply patches to dependencies in the modules directory.
-   */
-  protected function apply($directory = NULL, array $files = array()) {
-    if ($directory || $files) {
-      // Passthru.
-      parent::apply($directory, $files);
-    }
-    else {
-      // Called as operation.
-      $directory = !empty($this->test['vcs']['dendencies']) ? $this->module_directory : NULL;
-      parent::apply($directory);
-    }
-  }
-
-  /**
-   * Get the relevant files to check for syntax.
-   *
-   * If patches and dependencies are being reviewed then make paths relative to modules.
-   */
-  protected function syntax_files() {
-    // If module(s) were specified then only syntax check those modules.
-    if (empty($this->test['files']) && !empty($this->test['review']['argument']['modules'])) {
-      $base = $this->checkout_directory . '/' . $this->module_directory;
-
-      $files = array();
-      foreach ($this->test['review']['argument']['modules'] as $module) {
-        if ($path = $this->module_path($module)) {
-          $scan = file_scan_directory($this->checkout_directory . '/' . $path, '.*');
-          foreach ($scan as $file) {
-            $files[] = str_replace($this->checkout_directory . '/', '', $file->filename);
-          }
-        }
-      }
-      return $files;
-    }
-
-    $files = parent::syntax_files();
-
-    // If there are patch files and dependencies then assume the patch files
-    // are relative to the modules.
-    if (!empty($this->test['files']) && !empty($this->test['vcs']['dendencies'])) {
-      foreach ($files as &$file) {
-        $file = $this->module_directory . '/' . $file;
-      }
-    }
-
-    return $files;
-  }
-
-  /**
-   * Ingore non-PHP files during syntax check.
-   */
-  protected function syntax_ignore(array $files) {
-    $php_extensions = array('php', 'inc', 'install', 'module', 'test');
-    foreach ($files as $key => $file) {
-      if (!in_array(pathinfo($file, PATHINFO_EXTENSION), $php_extensions)) {
-        unset($files[$key]);
-      }
-    }
-    return $files;
-  }
-
-  /**
-   * Check syntax using PHP parser.
-   */
-  protected function syntax_check($file) {
-    return $this->exec('php -l -f ./' . $file);
-  }
-
-  /**
-   * Run the Drupal installer.
-   */
-  protected function install() {
-    global $base_url, $base_path;
-
-    // Make a copy of the settings file to ensure there is no permission issue.
-    $default_settings = $this->checkout_directory . '/sites/default/default.settings.php';
-    $settings = $this->checkout_directory . '/sites/default/settings.php';
-    copy($default_settings, $settings);
-
-    // Use paths relative to checkout directory so that SimpleTest browser will function.
-    $base_url .= '/checkout';
-    $base_path = '/checkout';
-    require_once drupal_get_path('module', 'pifr_client') . '/review/browser.inc';
-
-    // Install Drupal.
-    $b = new PIFRBrowser();
-
-    // Step: Select an installation profile.
-    // Step: Choose language.
-    $b->drupalGet('install.php', array('query' => 'profile=default&locale=en'));
-
-    // Step: Database configuration.
-    $db_info = $this->database->get_information();
-    $edit = array();
-    if ($b->xpath('//input[@name="driver"]')) {
-      $edit['driver'] = pifr_client_review_database_type();
-    }
-
-    if ($this->test['review']['argument']['core'] == 6) {
-      // Drupal 6.
-      $edit['db_path'] = $db_info['name'];
-      $edit['db_user'] = $db_info['username'];
-      $edit['db_pass'] = $db_info['password'];
-      $edit['db_host'] = $db_info['host'];
-    }
-    else {
-      // Drupal 7 and above.
-      $edit['database'] = $db_info['name'];
-      $edit['username'] = $db_info['username'];
-      $edit['password'] = $db_info['password'];
-      $edit['host'] = $db_info['host'];
-    }
-
-    $edit['db_prefix'] = '';
-    $b->drupalPost(NULL, $edit, t('Save and continue'));
-
-    // Step: Site configuration.
-    $edit = array();
-    $edit['site_name'] = 'checkout';
-    $edit['site_mail'] = 'admin@example.com';
-    $edit['account[name]'] = 'admin';
-    $edit['account[mail]'] = 'admin@example.com';
-    $edit['account[pass][pass1]'] = $this->admin_password = $b->randomName(12);
-    $edit['account[pass][pass2]'] = $this->admin_password;
-    $edit['update_status_module[1]'] = FALSE;
-    $b->drupalPost(NULL, $edit, t('Save and continue'));
-
-    // Step: Finished.
-    $b->assertText(t('Drupal installation complete'));
-
-    $base_url = $this->original['base_url'];
-    $base_path = $this->original['base_path'];
-
-    // Make sure that site installed correctly.
-    if (($b->results['#exception'] + $b->results['#fail']) != 0) {
-      $this->set_error();
-    }
-  }
-
-  /**
    * Run SimpleTest(s).
    */
   protected function test() {
@@ -419,30 +193,4 @@
     }
     return $result;
   }
-
-  /**
-   * Get the relative path to a module in the checkout directory.
-   *
-   * @param string $module Name of the module.
-   * @param boolean $reset Reset the static list of modules.
-   * @return string Relative location of file, or FALSE.
-   */
-  protected function module_path($module, $reset = FALSE) {
-    static $modules = array();
-
-    if (!$modules || $reset) {
-      $files = file_scan_directory($this->checkout_directory . '/' . $this->module_directory, '\.module$');
-      foreach ($files as $file) {
-        $modules[basename($file->basename, '.module')] = str_replace($this->checkout_directory . '/', '', dirname($file->filename));
-      }
-    }
-
-    if (isset($modules[$module])) {
-      return $modules[$module];
-    }
-
-    $this->log('No such module [' . $module . '].');
-    $this->set_error(array('@reason' => 'No such module [' . $module . ']'));
-    return FALSE;
-  }
 }
Index: review/simpletest/pifr_simpletest.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/simpletest/pifr_simpletest.info,v
retrieving revision 1.2
diff -u -r1.2 pifr_simpletest.info
--- review/simpletest/pifr_simpletest.info	10 Oct 2009 21:39:04 -0000	1.2
+++ review/simpletest/pifr_simpletest.info	7 Dec 2009 23:21:22 -0000
@@ -9,3 +9,4 @@
 files[] = pifr_simpletest.install
 files[] = pifr_simpletest.server.inc
 dependencies[] = pifr_assertion
+dependencies[] = pifr_drupal
Index: review/drupal/pifr_drupal.info
===================================================================
RCS file: review/drupal/pifr_drupal.info
diff -N review/drupal/pifr_drupal.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ review/drupal/pifr_drupal.info	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,8 @@
+; $Id$
+name = PIFR Coder
+description = Provide PIFR review base implementation for Drupal.
+package = Project Issue File Review Plugins
+core = 6.x
+php = 5
+files[] = pifr_drupal.client.inc
+files[] = pifr_drupal.module
Index: review/drupal/pifr_drupal.module
===================================================================
RCS file: review/drupal/pifr_drupal.module
diff -N review/drupal/pifr_drupal.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ review/drupal/pifr_drupal.module	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,9 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Provide PIFR review base implementation for Drupal.
+ *
+ * @author Jimmy Berry ("boombatower", http://drupal.org/user/214218)
+ */
Index: review/drupal/pifr_drupal.client.inc
===================================================================
RCS file: review/drupal/pifr_drupal.client.inc
diff -N review/drupal/pifr_drupal.client.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ review/drupal/pifr_drupal.client.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,280 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Provide Drupal client review base implementation.
+ *
+ * @author Jimmy Berry ("boombatower", http://drupal.org/user/214218)
+ */
+
+/**
+ * Drupal client review base implementation.
+ */
+class pifr_client_review_pifr_drupal extends pifr_client_review {
+
+  /**
+   * Default Drupal core repository URL.
+   */
+  protected $core_url = ':pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/drupal';
+
+  /**
+   * Location of default sites module directory.
+   */
+  protected $module_directory = 'sites/default/modules';
+
+  /**
+   * Administrator password used when installing Drupal.
+   */
+  protected $admin_password;
+
+  /**
+   * Add install and test steps.
+   */
+  public function __construct(array $test) {
+    parent::__construct($test);
+
+    // Allow the Drupal core URL to be overridden via an argument.
+    if (!empty($this->test['review']['argument']['core-url'])) {
+      $this->core_url = $this->test['review']['argument']['core-url'];
+    }
+
+    if ($this->test['vcs']['main']['repository']['url'] != $this->core_url) {
+      // Main repository is not core, so this must be a module test. Move the
+      // module repository (main) to the dependencies and find the core
+      // repository in the dependencies and move it to main.
+      $this->test['vcs']['dependencies'][] = $this->test['vcs']['main'];
+
+      foreach ($this->test['vcs']['dependencies'] as $key => $dependency) {
+        if ($dependency['repository']['url'] == $this->core_url) {
+          $this->test['vcs']['main'] = $dependency;
+          unset($this->test['vcs']['dependencies'][$key]);
+          break;
+        }
+      }
+    }
+
+    if ($this->test['review']['argument']['core'] == 6) {
+      // Since SimpleTest is not included in Drupal 6 it needs to be
+      // checked out from contrib.
+      $this->test['vcs']['dependencies'][] = array(
+        'repository' => array(
+          'type' => 'cvs',
+          'url' => ':pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib/contributions/modules/simpletest',
+        ),
+        'vcs_identifier' => 'DRUPAL-6--2',
+      );
+    }
+
+    $this->operations[] = 'install';
+  }
+
+  /**
+   * Checkout dependencies into the modules directory.
+   */
+  protected function checkout() {
+    // Checkout Drupal core.
+    parent::checkout();
+
+    if (!$this->has_error()) {
+      // Checkout modules if specified.
+      if (!empty($this->test['vcs']['dependencies'])) {
+        $directory = $this->checkout_directory . '/' . $this->module_directory;
+        if (!file_check_directory($directory, FILE_CREATE_DIRECTORY)) {
+          $this->set_error(array('@reason' => 'failed to create modules directory'));
+          return;
+        }
+
+        // Checkout module dependencies into the modules directory.
+        $this->checkout_dependencies($this->test['vcs']['dependencies']);
+      }
+    }
+  }
+
+  /**
+   * Checkout the list of dependencies into the modules directory.
+   *
+   * @param array $dependencies List of dependencies VCS information.
+   */
+  protected function checkout_dependencies(array $dependencies) {
+    $directory = $this->checkout_directory . '/' . $this->module_directory;
+    foreach ($dependencies as $dependency) {
+      $this->checkout_branch($dependency, $directory);
+
+      $display = $this->checkout_display($dependency);
+      if ($this->has_error()) {
+        $this->log('Dependency [' . $display . '] checkout failed.');
+        break;
+      }
+
+      $this->log('Dependency [' . $display . '] checkout complete.');
+    }
+  }
+
+  /**
+   * Apply patches to dependencies in the modules directory.
+   */
+  protected function apply($directory = NULL, array $files = array()) {
+    if ($directory || $files) {
+      // Passthru.
+      parent::apply($directory, $files);
+    }
+    else {
+      // Called as operation.
+      $directory = !empty($this->test['vcs']['dendencies']) ? $this->module_directory : NULL;
+      parent::apply($directory);
+    }
+  }
+
+  /**
+   * Get the relevant files to check for syntax.
+   *
+   * If patches and dependencies are being reviewed then make paths relative to modules.
+   */
+  protected function syntax_files() {
+    // If module(s) were specified then only syntax check those modules.
+    if (empty($this->test['files']) && !empty($this->test['review']['argument']['modules'])) {
+      $base = $this->checkout_directory . '/' . $this->module_directory;
+
+      $files = array();
+      foreach ($this->test['review']['argument']['modules'] as $module) {
+        if ($path = $this->module_path($module)) {
+          $scan = file_scan_directory($this->checkout_directory . '/' . $path, '.*');
+          foreach ($scan as $file) {
+            $files[] = str_replace($this->checkout_directory . '/', '', $file->filename);
+          }
+        }
+      }
+      return $files;
+    }
+
+    $files = parent::syntax_files();
+
+    // If there are patch files and dependencies then assume the patch files
+    // are relative to the modules.
+    if (!empty($this->test['files']) && !empty($this->test['vcs']['dendencies'])) {
+      foreach ($files as &$file) {
+        $file = $this->module_directory . '/' . $file;
+      }
+    }
+
+    return $files;
+  }
+
+  /**
+   * Ingore non-PHP files during syntax check.
+   */
+  protected function syntax_ignore(array $files) {
+    $php_extensions = array('php', 'inc', 'install', 'module', 'test');
+    foreach ($files as $key => $file) {
+      if (!in_array(pathinfo($file, PATHINFO_EXTENSION), $php_extensions)) {
+        unset($files[$key]);
+      }
+    }
+    return $files;
+  }
+
+  /**
+   * Check syntax using PHP parser.
+   */
+  protected function syntax_check($file) {
+    return $this->exec('php -l -f ./' . $file);
+  }
+
+  /**
+   * Run the Drupal installer.
+   */
+  protected function install() {
+    global $base_url, $base_path;
+
+    // Make a copy of the settings file to ensure there is no permission issue.
+    $default_settings = $this->checkout_directory . '/sites/default/default.settings.php';
+    $settings = $this->checkout_directory . '/sites/default/settings.php';
+    copy($default_settings, $settings);
+
+    // Use paths relative to checkout directory so that SimpleTest browser will function.
+    $base_url .= '/checkout';
+    $base_path = '/checkout';
+    require_once drupal_get_path('module', 'pifr_client') . '/review/browser.inc';
+
+    // Install Drupal.
+    $b = new PIFRBrowser();
+
+    // Step: Select an installation profile.
+    // Step: Choose language.
+    $b->drupalGet('install.php', array('query' => 'profile=default&locale=en'));
+
+    // Step: Database configuration.
+    $db_info = $this->database->get_information();
+    $edit = array();
+    if ($b->xpath('//input[@name="driver"]')) {
+      $edit['driver'] = pifr_client_review_database_type();
+    }
+
+    if ($this->test['review']['argument']['core'] == 6) {
+      // Drupal 6.
+      $edit['db_path'] = $db_info['name'];
+      $edit['db_user'] = $db_info['username'];
+      $edit['db_pass'] = $db_info['password'];
+      $edit['db_host'] = $db_info['host'];
+    }
+    else {
+      // Drupal 7 and above.
+      $edit['database'] = $db_info['name'];
+      $edit['username'] = $db_info['username'];
+      $edit['password'] = $db_info['password'];
+      $edit['host'] = $db_info['host'];
+    }
+
+    $edit['db_prefix'] = '';
+    $b->drupalPost(NULL, $edit, t('Save and continue'));
+
+    // Step: Site configuration.
+    $edit = array();
+    $edit['site_name'] = 'checkout';
+    $edit['site_mail'] = 'admin@example.com';
+    $edit['account[name]'] = 'admin';
+    $edit['account[mail]'] = 'admin@example.com';
+    $edit['account[pass][pass1]'] = $this->admin_password = $b->randomName(12);
+    $edit['account[pass][pass2]'] = $this->admin_password;
+    $edit['update_status_module[1]'] = FALSE;
+    $b->drupalPost(NULL, $edit, t('Save and continue'));
+
+    // Step: Finished.
+    $b->assertText(t('Drupal installation complete'));
+
+    $base_url = $this->original['base_url'];
+    $base_path = $this->original['base_path'];
+
+    // Make sure that site installed correctly.
+    if (($b->results['#exception'] + $b->results['#fail']) != 0) {
+      $this->set_error();
+    }
+  }
+
+  /**
+   * Get the relative path to a module in the checkout directory.
+   *
+   * @param string $module Name of the module.
+   * @param boolean $reset Reset the static list of modules.
+   * @return string Relative location of file, or FALSE.
+   */
+  protected function module_path($module, $reset = FALSE) {
+    static $modules = array();
+
+    if (!$modules || $reset) {
+      $files = file_scan_directory($this->checkout_directory . '/' . $this->module_directory, '\.module$');
+      foreach ($files as $file) {
+        $modules[basename($file->basename, '.module')] = str_replace($this->checkout_directory . '/', '', dirname($file->filename));
+      }
+    }
+
+    if (isset($modules[$module])) {
+      return $modules[$module];
+    }
+
+    $this->log('No such module [' . $module . '].');
+    $this->set_error(array('@reason' => 'No such module [' . $module . ']'));
+    return FALSE;
+  }
+}
