Index: review/simpletest/pifr_simpletest.server.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/simpletest/pifr_simpletest.server.inc,v retrieving revision 1.17 diff -u -r1.17 pifr_simpletest.server.inc --- review/simpletest/pifr_simpletest.server.inc 31 Dec 2009 22:10:58 -0000 1.17 +++ review/simpletest/pifr_simpletest.server.inc 23 Feb 2010 21:07:04 -0000 @@ -15,20 +15,19 @@ */ class pifr_server_review_pifr_simpletest extends pifr_server_review_pifr_drupal { - protected $argument_default = array( - 'core' => 7, - 'tests' => array(), - 'modules' => array(), - 'directory' => '', - 'clone-db' => '', - ); - /** - * Modify step information. + * Modify step information and append default arguments. */ public function __construct() { parent::__construct(); + $this->argument_default += array( + 'simpletest.tests' => array(), + 'simpletest.db.url' => NULL, + 'simpletest.db.user' => NULL, + 'simpletest.db.pass' => NULL, + ); + $this->steps['review'] = array_merge($this->steps['review'], array( 'title' => 'test run failure', 'active title' => 'detect a test run failure', 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.39 diff -u -r1.39 pifr_simpletest.client.inc --- review/simpletest/pifr_simpletest.client.inc 26 Jan 2010 07:10:55 -0000 1.39 +++ review/simpletest/pifr_simpletest.client.inc 23 Feb 2010 21:07:04 -0000 @@ -21,8 +21,8 @@ public function __construct(array $test) { parent::__construct($test); - if (!empty($this->test['review']['argument']['clone-db'])) { - $this->test['files'][] = $this->test['review']['argument']['clone-db']; + if (!empty($this->arguments['simpletest.db.url'])) { + $this->test['files'][] = $this->arguments['simpletest.db.url']; } } @@ -32,7 +32,7 @@ protected function install() { parent::install(); - if (!empty($this->test['review']['argument']['clone-db'])) { + if (!empty($this->arguments['simpletest.db.url'])) { // Drupal install() will have taken care of settings.php and such so drop // and create database to be filled by clone-db. $this->database->drop_database(); @@ -40,17 +40,17 @@ // Since a database import is being used the username and password must // be included in arguments. - if (!empty($this->test['review']['argument']['clone-db-user']) && - !empty($this->test['review']['argument']['clone-db-pass'])) { - $this->admin_username = $this->test['review']['argument']['clone-db-user']; - $this->admin_password = $this->test['review']['argument']['clone-db-pass']; + if (!empty($this->arguments['simpletest.db.user']) && + !empty($this->arguments['simpletest.db.pass'])) { + $this->admin_username = $this->arguments['simpletest.db.user']; + $this->admin_password = $this->arguments['simpletest.db.pass']; } else { $this->set_error(array('@reason' => 'both [clone-db-user] and [clone-db-pass] must be specified')); return; } - $basename = basename($this->test['review']['argument']['clone-db']); + $basename = basename($this->arguments['simpletest.db.url']); foreach ($this->files as $file) { if (basename($file) == $basename) { $this->log('Importing clone database from [' . $basename . ']...'); @@ -74,7 +74,7 @@ global $base_url, $base_path; // If Drupal 6 then we need to perform SimpleTest installation. - if ($this->test['review']['argument']['core'] == 6) { + if ($this->arguments['drupal.core.version'] == 6) { if (!$this->test_prepare()) { return; } @@ -101,7 +101,7 @@ // Enable SimpleTest. $edit = array(); - if ($this->test['review']['argument']['core'] == 6) { + if ($this->arguments['drupal.core.version'] == 6) { // Drupal 6. $edit['status[simpletest]'] = TRUE; $b->drupalPost('admin/build/modules', $edit, t('Save configuration')); @@ -171,12 +171,12 @@ * @return string Tests argument to be appended to run-test.sh command. */ protected function test_list() { - if (!empty($this->test['review']['argument']['tests'])) { - return '--class ' . implode(',', $this->test['review']['argument']['tests']); + if (!empty($this->arguments['simpletest.tests'])) { + return '--class ' . implode(',', $this->arguments['simpletest.tests']); } - elseif (!empty($this->test['review']['argument']['modules'])) { + elseif (!empty($this->arguments['drupal.modules'])) { $args = array(); - foreach ($this->test['review']['argument']['modules'] as $module) { + foreach ($this->arguments['drupal.modules'] as $module) { // Check the root module directory for a test. $file = $this->module_path($module) . '/' . $module . '.test'; if (file_exists($this->checkout_directory . '/' . $file)) { @@ -191,8 +191,8 @@ } return '--file ' . implode(',', $args); } - elseif (!empty($this->test['review']['argument']['directory'])) { - $scan = file_scan_directory($this->checkout_directory . '/' . $this->test['review']['argument']['directory'], '\.test$'); + elseif (!empty($this->arguments['test.directory'])) { + $scan = file_scan_directory($this->checkout_directory . '/' . $this->arguments['test.directory'], '\.test$'); $files = array(); foreach ($scan as $file) { Index: review/coder/pifr_coder.client.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/coder/pifr_coder.client.inc,v retrieving revision 1.18 diff -u -r1.18 pifr_coder.client.inc --- review/coder/pifr_coder.client.inc 17 Feb 2010 22:38:30 -0000 1.18 +++ review/coder/pifr_coder.client.inc 23 Feb 2010 21:07:03 -0000 @@ -42,9 +42,9 @@ * Use files argument for list of files if specified. */ protected function syntax_files() { - if (!empty($this->test['review']['argument']['files'])) { + if (!empty($this->arguments['test.files'])) { $files = array(); - foreach ($this->test['review']['argument']['files'] as $file) { + foreach ($this->arguments['test.files'] as $file) { if (file_exists($this->checkout_directory . '/' . $file)) { $files[] = $file; } @@ -111,7 +111,7 @@ $this->results[$file] = do_coder_reviews($args); // If annotate is TRUE, then set the group to the responsible party. - if ($this->test['review']['argument']['pifr_coder.annotate']) { + if ($this->arguments['coder.annotate']) { $this->review_annotate($file, $this->results[$file]); } } @@ -128,20 +128,20 @@ if (!empty($this->test['files'])) { return $this->syntax_files(); } - elseif (!empty($this->test['review']['argument']['files'])) { + elseif (!empty($this->arguments['test.files'])) { return $this->syntax_files(); } - elseif (!empty($this->test['review']['argument']['modules'])) { + elseif (!empty($this->arguments['drupal.modules'])) { $files = array(); - foreach ($this->test['review']['argument']['modules'] as $module) { + foreach ($this->arguments['drupal.modules'] as $module) { $files = array_merge($files, file_scan_directory($this->module_path($module), '/.*/')); } return $files; } - elseif (!empty($this->test['review']['argument']['directory'])) { + elseif (!empty($this->arguments['test.directory'])) { $files = $this->syntax_files(); foreach ($files as $key => $file) { - if (strpos($file, $this->test['review']['argument']['directory']) !== 0) { + if (strpos($file, $this->arguments['test.directory']) !== 0) { unset($files[$key]); } } Index: review/coder/pifr_coder.server.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/coder/pifr_coder.server.inc,v retrieving revision 1.7 diff -u -r1.7 pifr_coder.server.inc --- review/coder/pifr_coder.server.inc 17 Feb 2010 22:38:30 -0000 1.7 +++ review/coder/pifr_coder.server.inc 23 Feb 2010 21:07:03 -0000 @@ -15,12 +15,6 @@ */ class pifr_server_review_pifr_coder extends pifr_server_review_pifr_drupal { - protected $argument_default = array( - 'modules' => array(), - 'directory' => '', - 'pifr_coder.annotate' => FALSE, - ); - protected $labels = array( 'pass' => 'minor', 'fail' => 'critical', @@ -30,11 +24,15 @@ protected $detail_message = '@pass minor(s), @fail critical(s), and @exception normal(s)'; /** - * Modify step information. + * Modify step information and append default arguments. */ public function __construct() { parent::__construct(); + $this->argument_default += array( + 'coder.annotate' => FALSE, + ); + unset($this->steps['install']); $this->steps['review'] = array_merge($this->steps['review'], array( 'confirmation' => FALSE, Index: review/server.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/server.inc,v retrieving revision 1.18 diff -u -r1.18 server.inc --- review/server.inc 3 Feb 2010 03:02:38 -0000 1.18 +++ review/server.inc 23 Feb 2010 21:07:03 -0000 @@ -18,7 +18,11 @@ * * @var array */ - protected $argument_default = array(); + protected $argument_default = array( + 'test.title' => NULL, + 'test.directory' => NULL, + 'test.files' => NULL, + ); /** * The operations which make up a review mapped to integer codes. Index: review/client.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/client.inc,v retrieving revision 1.34 diff -u -r1.34 client.inc --- review/client.inc 19 Feb 2010 21:18:00 -0000 1.34 +++ review/client.inc 23 Feb 2010 21:07:03 -0000 @@ -65,6 +65,13 @@ protected $test; /** + * Associative array of arguments provided with the test. + * + * @var array + */ + protected $arguments; + + /** * Database backend. * * @var object. @@ -133,6 +140,7 @@ 'base_path' => $base_path, ); $this->test = $test; + $this->arguments = $this->test['review']['argument']; $this->log('Environment variables and review information initialized.'); self::$instance = $this; Index: review/drupal/pifr_drupal.client.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/drupal/pifr_drupal.client.inc,v retrieving revision 1.9 diff -u -r1.9 pifr_drupal.client.inc --- review/drupal/pifr_drupal.client.inc 27 Jan 2010 02:11:33 -0000 1.9 +++ review/drupal/pifr_drupal.client.inc 23 Feb 2010 21:07:03 -0000 @@ -14,11 +14,6 @@ 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'; @@ -46,12 +41,7 @@ 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) { + if ($this->test['vcs']['main']['repository']['url'] != $this->arguments['drupal.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. @@ -61,7 +51,7 @@ $this->project_directory = basename($this->test['vcs']['main']['repository']['url']); foreach ($this->test['vcs']['dependencies'] as $key => $dependency) { - if ($dependency['repository']['url'] == $this->core_url) { + if ($dependency['repository']['url'] == $this->arguments['drupal.core.url']) { $this->test['vcs']['main'] = $dependency; unset($this->test['vcs']['dependencies'][$key]); break; @@ -70,7 +60,7 @@ } // Add SimpleTest as dependencies, unless it has already been added. - if ($this->test['review']['argument']['core'] == 6) { + if ($this->arguments['drupal.core.version'] == 6) { $simpletest_url = ':pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib/contributions/modules/simpletest'; $found = FALSE; foreach ($this->test['vcs']['dependencies'] as $key => $dependency) { @@ -159,9 +149,9 @@ protected function syntax_files() { // If no files to apply then attempt to filter files by arguments. if (!$this->apply_files()) { - if (!empty($this->test['review']['argument']['modules'])) { + if (!empty($this->arguments['drupal.modules'])) { $files = array(); - foreach ($this->test['review']['argument']['modules'] as $module) { + foreach ($this->arguments['drupal.modules'] as $module) { if ($path = $this->module_path($module)) { $scan = file_scan_directory($this->checkout_directory . '/' . $path, '.*'); foreach ($scan as $file) { @@ -171,8 +161,8 @@ } return $files; } - elseif (!empty($this->test['review']['argument']['directory'])) { - $scan = file_scan_directory($this->checkout_directory . '/' . $this->test['review']['argument']['directory'], '.*'); + elseif (!empty($this->arguments['test.directory'])) { + $scan = file_scan_directory($this->checkout_directory . '/' . $this->arguments['test.directory'], '.*'); $files = array(); foreach ($scan as $file) { $files[] = str_replace($this->checkout_directory . '/', '', $file->filename); @@ -235,7 +225,7 @@ // Step: Select an installation profile. // Step: Choose language. - $pofile = $this->test['review']['argument']['core'] == 6 ? 'default' : 'standard'; + $pofile = $this->arguments['drupal.core.version'] == 6 ? 'default' : 'standard'; if (!$b->drupalGet('install.php', array('query' => 'profile=' . $pofile . '&locale=en'))) { $this->set_error(array('@reason' => 'failed to start process')); return; @@ -248,7 +238,7 @@ $edit['driver'] = pifr_client_review_database_type(); } - if ($this->test['review']['argument']['core'] == 6) { + if ($this->arguments['drupal.core.version'] == 6) { // Drupal 6. $edit['db_path'] = $db_info['name']; $edit['db_user'] = $db_info['username']; Index: review/drupal/pifr_drupal.server.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/review/drupal/pifr_drupal.server.inc,v retrieving revision 1.5 diff -u -r1.5 pifr_drupal.server.inc --- review/drupal/pifr_drupal.server.inc 19 Dec 2009 00:00:22 -0000 1.5 +++ review/drupal/pifr_drupal.server.inc 23 Feb 2010 21:07:03 -0000 @@ -15,18 +15,18 @@ */ abstract class pifr_server_review_pifr_drupal extends pifr_server_review_pifr_assertion { - protected $argument_default = array( - 'core' => 7, - 'database' => 'mysql-5.0-isam', - 'modules' => array(), - ); - /** - * Modify step information. + * Modify step information and append default arguments. */ public function __construct() { parent::__construct(); + $this->argument_default += array( + 'drupal.core.version' => 7, + 'drupal.core.url' => ':pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/drupal', + 'drupal.modules' => array(), + ); + $this->steps['syntax'] = array_merge($this->steps['syntax'], array( 'title' => 'invalid PHP syntax', 'active title' => 'detect invalid PHP syntax', Index: server/pifr_server.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/server/pifr_server.install,v retrieving revision 1.48 diff -u -r1.48 pifr_server.install --- server/pifr_server.install 23 Feb 2010 02:46:56 -0000 1.48 +++ server/pifr_server.install 23 Feb 2010 21:07:04 -0000 @@ -682,3 +682,56 @@ return $ret; } + +/** + * Update plugin argument keys. + */ +function pifr_server_update_6206() { + $result = db_query('SELECT branch_id FROM {pifr_branch}'); + while ($branch_id = db_result($result)) { + $branch = pifr_server_branch_get($branch_id); + $branch['plugin_argument'] = pifr_server_update_6206_map($branch['plugin_argument']); + pifr_server_branch_save($branch, FALSE); + } + + $result = db_query('SELECT environment_id FROM {pifr_environment}'); + while ($environment_id = db_result($result)) { + $environment = pifr_server_environment_get($environment_id); + $environment['plugin_argument'] = pifr_server_update_6206_map($environment['plugin_argument']); + pifr_server_environment_save($environment, FALSE); + } + + return array(); +} + +/** + * Map old plugin argument keys to new keys. + * + * @param array $array Old plugin argument array. + * @return array Updated plugin argument array. + */ +function pifr_server_update_6206_map(array $array) { + static $map = array( + 'directory' => 'test.directory', + 'files' => 'test.files', + 'core' => 'drupal.core.version', + 'core-url' => 'drupal.core.url', + 'modules' => 'drupal.modules', + 'pifr_coder.annotate' => 'coder.annotate', + 'tests' => 'simpletest.tests', + 'clone-db' => 'simpletest.db.url', + 'clone-db-user' => 'simpletest.db.user', + 'clone-db-pass' => 'simpletest.db.pass', + ); + + $new = array(); + foreach ($array as $key => $value) { + if (isset($map[$key])) { + $new[$map[$key]] = $value; + } + else { + $new[$key] = $value; + } + } + return $new; +}